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

[pull] master from layer5io:master #78

Merged
merged 10 commits into from
Feb 10, 2025
3 changes: 2 additions & 1 deletion src/custom/ResourceDetailFormatters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
TextWithLinkFormatter
} from './Formatter';
import { useResourceCleanData } from './useResourceCleanData';
import { extractPodVolumnTables, splitCamelCaseString } from './utils';
import { convertToReadableUnit, extractPodVolumnTables, splitCamelCaseString } from './utils';

export {
CodeFormatter,
Expand All @@ -33,6 +33,7 @@ export {
StatusFormatter,
TableDataFormatter,
TextWithLinkFormatter,
convertToReadableUnit,
extractPodVolumnTables,
splitCamelCaseString,
useResourceCleanData
Expand Down
14 changes: 14 additions & 0 deletions src/custom/ResourceDetailFormatters/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,17 @@ export function isEmptyAtAllDepths(input: any): boolean {
return _.isEmpty(input);
}
}

export const convertToReadableUnit = (value: number): string => {
if (!value) return '0';

const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];
let index = 0;

while (value >= 1024 && index < units.length - 1) {
value /= 1024;
index++;
}

return `${value.toFixed(2)} ${units[index]}`;
};
4 changes: 3 additions & 1 deletion src/theme/components/appbar.modifiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ export const MuiAppBar: Components<Theme>['MuiAppBar'] = {
const {
palette: {
background: { default: defaultBackground }
}
},
typography: { fontFamily }
} = theme;
return {
fontFamily,
elevation: 2,
background: defaultBackground
};
Expand Down
3 changes: 2 additions & 1 deletion src/theme/components/buttongroup.modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Components, Theme } from '@mui/material';
export const MuiButtonGroup: Components<Theme>['MuiButtonGroup'] = {
styleOverrides: {
grouped: ({ theme }) => ({
borderColor: theme.palette.common.white
borderColor: theme.palette.common.white,
fontFamily: theme.typography.fontFamily
})
}
};
4 changes: 3 additions & 1 deletion src/theme/components/link.modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ export const MuiLink: Components<Theme>['MuiLink'] = {
palette: {
text: { default: defaultText },
background: { brand }
}
},
typography: { fontFamily }
} = theme;
return {
fontFamily: fontFamily,
fontWeight: '600',
textDecoration: 'none',
color: defaultText,
Expand Down
4 changes: 3 additions & 1 deletion src/theme/components/listitem.modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export const MuiListItem: Components<Theme>['MuiListItem'] = {
text: { default: defaultText },
icon: { default: defaultIcon },
background: { brand }
}
},
typography: { fontFamily }
} = theme;
return {
fontFamily,
textTransform: 'none',
margin: '.5rem 0rem .5rem .5rem',
padding: '0rem',
Expand Down
20 changes: 14 additions & 6 deletions src/theme/components/menu.modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ import { Components, Theme } from '@mui/material';

export const MuiMenu: Components<Theme>['MuiMenu'] = {
styleOverrides: {
paper: {
'& .MuiMenuItem-root.Mui-selected': {
backgroundColor: 'rgba(0, 0, 0, 0.08)',
'&:hover': {
backgroundColor: 'rgba(0, 0, 0, 0.08)'
root: ({ theme }) => {
const {
typography: { fontFamily }
} = theme;
return {
paper: {
fontFamily: fontFamily,
'& .MuiMenuItem-root.Mui-selected': {
backgroundColor: 'rgba(0, 0, 0, 0.08)',
'&:hover': {
backgroundColor: 'rgba(0, 0, 0, 0.08)'
}
}
}
}
};
}
}
};
4 changes: 3 additions & 1 deletion src/theme/components/menuitem.modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ export const MuiMenuItem: Components<Theme>['MuiMenuItem'] = {
const {
palette: {
text: { tertiary }
}
},
typography: { fontFamily }
} = theme;
return {
fontFamily: fontFamily,
'&:hover': {
'& li': {
color: tertiary,
Expand Down
4 changes: 3 additions & 1 deletion src/theme/components/tab.modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ export const MuiTab: Components<Theme>['MuiTab'] = {
palette: {
text: { default: defaultText },
background: { tabs: defaultBackground }
}
},
typography: { textB1Regular }
} = theme;
return {
...textB1Regular,
'&.Mui-selected': {
color: defaultText,
backgroundColor: defaultBackground
Expand Down
3 changes: 2 additions & 1 deletion src/theme/components/tabs.modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Components, Theme } from '@mui/material';
export const MuiTabs: Components<Theme>['MuiTabs'] = {
styleOverrides: {
root: ({ theme }) => ({
backgroundColor: theme.palette.background.tabs
backgroundColor: theme.palette.background.tabs,
fontFamily: theme.typography.fontFamily
}),
indicator: ({ theme }) => ({
backgroundColor: theme.palette.background.brand?.default
Expand Down
Loading