Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MUI theme config to fix Sidebar and Tabs color #960

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sweet-colts-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'app': minor
---

updated Nav and tab styles to match PatternFly5.
3 changes: 0 additions & 3 deletions packages/app/src/components/Root/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ import { IconComponent, useApp } from '@backstage/core-plugin-api';
const useStyles = makeStyles()({
sidebarItem: {
textDecorationLine: 'none',
'&:hover': {
textDecorationLine: 'underline',
},
},
});

Expand Down
55 changes: 51 additions & 4 deletions packages/app/src/themes/componentOverrides.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UnifiedThemeOptions } from '@backstage/theme';
import { ThemeColors } from '../types/types';

const redhatFont = `@font-face {
font-family: 'Red Hat Font';
Expand All @@ -10,8 +11,54 @@ const redhatFont = `@font-face {
url(/fonts/RedHatText-Regular.ttf) format('truetype');
}`;

export const components: UnifiedThemeOptions['components'] = {
MuiCssBaseline: {
styleOverrides: redhatFont,
},
export const components = (
themeColors: ThemeColors,
): UnifiedThemeOptions['components'] => {
return {
BackstageHeaderTabs: {
styleOverrides: {
tabsWrapper: {
paddingLeft: '0px',
},
defaultTab: {
textTransform: 'none',
fontSize: '0.875rem',
},
},
},
MuiTabs: {
defaultProps: {
TabIndicatorProps: {
style: {
height: '3px',
background: themeColors.navigationIndicatorColor || '#0066CC',
},
},
},
styleOverrides: {
root: {
borderBottom: '1px solid #d2d2d2',
},
},
},
MuiTab: {
defaultProps: {
disableRipple: true,
},
styleOverrides: {
root: {
minWidth: 'initial !important',
'&:hover': {
boxShadow: '0 -3px #b8bbbe inset',
},
},
disabled: {
backgroundColor: '#6a6e73',
},
},
},
MuiCssBaseline: {
styleOverrides: redhatFont,
},
};
};
6 changes: 3 additions & 3 deletions packages/app/src/themes/darkTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export const customDarkTheme = (themeColors: ThemeColors) =>
}),
navigation: {
background: '#0f1214',
indicator: themeColors.navigationIndicatorColor || '#009596',
indicator: themeColors.navigationIndicatorColor || '#0066CC',
color: '#ffffff',
selectedColor: '#ffffff',
navItem: {
hoverBackground: '#030303',
hoverBackground: '#3c3f42',
},
},
},
defaultPageTheme: 'home',
pageTheme: pageTheme(themeColors),
components,
components: components(themeColors),
});
10 changes: 7 additions & 3 deletions packages/app/src/themes/lightTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ export const customLightTheme = (themeColors: ThemeColors) =>
}),
navigation: {
background: '#222427',
indicator: themeColors.navigationIndicatorColor || '#009596',
indicator: themeColors.navigationIndicatorColor || '#0066CC',
color: '#ffffff',
selectedColor: '#ffffff',
navItem: {
hoverBackground: '#4f5255',
hoverBackground: '#3c3f42',
},
},
text: {
primary: '#151515',
secondary: '#757575',
},
},
defaultPageTheme: 'home',
pageTheme: pageTheme(themeColors),
components,
components: components(themeColors),
});
Loading