Skip to content

Commit

Permalink
Merge pull request #59 from galaxyproject/fran/53-header-nav
Browse files Browse the repository at this point in the history
fix: highlight selected page in topnav (#53)
  • Loading branch information
NoopDog authored Sep 13, 2024
2 parents 9fc1f53 + bce8723 commit d226ede
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
6 changes: 4 additions & 2 deletions app/theme/common/palette.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PaletteColorOptions } from "@mui/material";
import { PaletteColor } from "@mui/material";

/**
* Palette "Hero"
Expand All @@ -17,7 +17,9 @@ export const heroMain = HERO.MAIN;
/**
* Palette Option "Hero"
*/
export const hero: PaletteColorOptions = {
export const hero: PaletteColor = {
contrastText: "#FFFFFF",
dark: heroMain,
light: heroLight,
main: heroMain,
};
23 changes: 12 additions & 11 deletions app/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import * as P from "./common/palette";
* @returns theme with custom theme overrides.
*/
export function mergeAppTheme(theme: Theme): Theme {
return createTheme(
deepmerge(theme, {
components: {
MuiButton: C.MuiButton(theme),
MuiCssBaseline: C.MuiCssBaseline(theme),
},
palette: {
hero: P.hero,
},
})
);
const appTheme = { ...theme };

// Merge palette with hero color.
appTheme.palette = { ...appTheme.palette, hero: P.hero };

// Marge custom components.
const components = {
MuiButton: C.MuiButton(appTheme),
MuiCssBaseline: C.MuiCssBaseline(appTheme),
};

return createTheme(deepmerge(appTheme, components));
}
2 changes: 1 addition & 1 deletion app/views/HomeView/homeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const HomeView = (): JSX.Element => {
<Fragment>
<SectionHero />
<SectionSubHero />
<SectionHelp />
<SectionAnalytics />
<SectionHelp />
<SectionBranding />
</Fragment>
);
Expand Down
21 changes: 11 additions & 10 deletions types/theme.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { Theme as MTheme } from "@mui/material";

/**
* Button prop options.
*/
declare module "@mui/material/Button" {
interface ButtonPropsColorOverrides {
hero: true;
}
}
import type {} from "@mui/material/Button";
import { PaletteColorOptions } from "@mui/material/styles";

/**
* Palette definitions.
Expand All @@ -22,6 +14,15 @@ declare module "@mui/material/styles/createPalette" {
}
}

/**
* Button prop options.
*/
declare module "@mui/material/Button" {
interface ButtonPropsColorOverrides {
hero: true;
}
}

declare module "@emotion/react" {
export interface Theme extends MTheme {
name: "EmotionTheme";
Expand Down

0 comments on commit d226ede

Please sign in to comment.