Skip to content

Commit ab59fd2

Browse files
committed
Add 'anaconda' class to document.body in Anaconda mode
Modals are rendered outside the Page component, so they don’t inherit its classes. Adding the 'anaconda' class directly to <body> ensures consistent styling across the UI.
1 parent 98c5474 commit ab59fd2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/storaged/pages.jsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import cockpit from "cockpit";
21-
import React, { useState, useRef } from "react";
21+
import React, { useEffect, useState, useRef } from "react";
2222
import client from "./client";
2323
import { useEvent } from "hooks.js";
2424

@@ -862,8 +862,17 @@ export const StorageDescription = ({ title, value, action, help, children }) =>
862862
export const StoragePage = ({ location, plot_state }) => {
863863
const page = get_page_from_location(location);
864864

865+
useEffect(() => {
866+
// Add the 'anaconda' class to <body> when in Anaconda mode.
867+
// This is needed because modals are rendered outside the Page component
868+
// and won’t inherit its classes.
869+
if (client.in_anaconda_mode()) {
870+
document.body.classList.add("anaconda");
871+
}
872+
}, []);
873+
865874
return (
866-
<Page id="storage" className={"no-masthead-sidebar" + (client.in_anaconda_mode() ? " anaconda" : "")}>
875+
<Page id="storage" className="no-masthead-sidebar">
867876
{ (!client.in_anaconda_mode() && page.parent) &&
868877
<PageBreadcrumb hasBodyWrapper={false} stickyOnBreakpoint={{ default: "top" }}>
869878
<StorageBreadcrumb page={page} />

0 commit comments

Comments
 (0)