Skip to content

Commit

Permalink
updated masthead to match website
Browse files Browse the repository at this point in the history
  • Loading branch information
evwilkin committed Feb 6, 2024
1 parent a9ab824 commit 574fd12
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/app/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,21 @@ interface IAppLayout {
const AppLayout: React.FunctionComponent<IAppLayout> = ({ children }) => {
const [sidebarOpen, setSidebarOpen] = React.useState(true);
const [isDarkTheme, setIsDarkTheme] = React.useState(false);
const [isRTL, setIsRTL] = React.useState(false);

const toggleDarkTheme = (_evt, selected) => {
const darkThemeToggleClicked = !selected === isDarkTheme;
document.querySelector('html').classList.toggle('pf-v5-theme-dark', darkThemeToggleClicked);

Check failure on line 42 in src/app/AppLayout/AppLayout.tsx

View workflow job for this annotation

GitHub Actions / Build

Object is possibly 'null'.
setIsDarkTheme(darkThemeToggleClicked);
};

const toggleRTL = () => {
const html = document.querySelector('html');
const curDir = html.dir;

Check failure on line 48 in src/app/AppLayout/AppLayout.tsx

View workflow job for this annotation

GitHub Actions / Build

'html' is possibly 'null'.
html.dir = curDir !== 'rtl' ? 'rtl' : 'ltr';

Check failure on line 49 in src/app/AppLayout/AppLayout.tsx

View workflow job for this annotation

GitHub Actions / Build

'html' is possibly 'null'.
};

const Header = (
<Masthead>
<Masthead className="demo-masthead">
<MastheadToggle>
<Button variant="plain" onClick={() => setSidebarOpen(!sidebarOpen)} aria-label="Global navigation">
<BarsIcon />
Expand Down Expand Up @@ -100,7 +105,11 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ children }) => {
<MastheadContent>
<Toolbar isFullHeight>
<ToolbarContent>
<ToolbarGroup align={{ default: 'alignRight' }} spaceItems={{ default: 'spacerNone', md: 'spacerMd' }}>
<ToolbarGroup
className="pf-m-align-end"
align={{ default: 'alignRight' }}
spaceItems={{ default: 'spacerNone', md: 'spacerMd' }}

Check failure on line 111 in src/app/AppLayout/AppLayout.tsx

View workflow job for this annotation

GitHub Actions / Build

Type '"spacerNone"' is not assignable to type '"spaceItemsNone" | "spaceItemsSm" | "spaceItemsMd" | "spaceItemsLg" | undefined'.

Check failure on line 111 in src/app/AppLayout/AppLayout.tsx

View workflow job for this annotation

GitHub Actions / Build

Type '"spacerMd"' is not assignable to type '"spaceItemsNone" | "spaceItemsSm" | "spaceItemsMd" | "spaceItemsLg" | undefined'.
>
<ToolbarItem>
<ToggleGroup aria-label="Dark theme toggle group">
<ToggleGroupItem
Expand All @@ -126,12 +135,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ children }) => {
</ToggleGroup>
</ToolbarItem>
<ToolbarItem>
<Switch
id="ws-rtl-switch"
label={'RTL'}
defaultChecked={isRTL}
onChange={() => setIsRTL((isRTL) => !isRTL)}
/>
<Switch id="ws-rtl-switch" label={'RTL'} defaultChecked={false} onChange={() => toggleRTL()} />
</ToolbarItem>
</ToolbarGroup>
</ToolbarContent>
Expand Down
6 changes: 6 additions & 0 deletions src/app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ body,
--pf-v5-c-content--blockquote--BorderLeftColor: purple; /* changes all <blockquote> left border color to purple */
--pf-v5-c-content--hr--BackgroundColor: lemonchiffon; /* changes a <hr> color to lemonchiffon */
}

.demo-masthead .pf-v5-c-toggle-group {
--pf-v5-c-toggle-group__button--m-selected--BackgroundColor: var(--pf-v5-global--palette--blue-400);
--pf-v5-c-toggle-group__button--focus--BackgroundColor: transparent;
--pf-v5-c-toggle-group__button--hover--BackgroundColor: transparent;
}

0 comments on commit 574fd12

Please sign in to comment.