implement responsive breadcrumb behaviour (#53764)

This commit is contained in:
Ashley Harrison
2022-08-19 09:17:52 +01:00
committed by GitHub
parent 7755f4c4ba
commit 78995e252a
@@ -44,6 +44,10 @@ export function BreadcrumbItem(props: Props) {
} }
const getStyles = (theme: GrafanaTheme2) => { const getStyles = (theme: GrafanaTheme2) => {
const separator = css({
color: theme.colors.text.secondary,
});
return { return {
breadcrumb: css({ breadcrumb: css({
alignItems: 'center', alignItems: 'center',
@@ -61,9 +65,21 @@ const getStyles = (theme: GrafanaTheme2) => {
color: theme.colors.text.primary, color: theme.colors.text.primary,
display: 'flex', display: 'flex',
fontWeight: theme.typography.fontWeightMedium, fontWeight: theme.typography.fontWeightMedium,
// logic for small screens
// hide any breadcrumbs that aren't the second to last child (the parent)
[theme.breakpoints.down('md')]: {
display: 'none',
'&:nth-last-child(2)': {
display: 'flex',
flexDirection: 'row-reverse',
[`.${separator}`]: {
transform: 'rotate(180deg)',
},
},
},
}), }),
separator: css({ separator,
color: theme.colors.text.secondary,
}),
}; };
}; };