|
|
|
@ -25,6 +25,11 @@ export interface Props { |
|
|
|
|
isFullscreen?: boolean; |
|
|
|
|
'aria-label'?: string; |
|
|
|
|
buttonOverflowAlignment?: 'left' | 'right'; |
|
|
|
|
/** |
|
|
|
|
* Forces left items to be visible on small screens. |
|
|
|
|
* By default left items are hidden on small screens. |
|
|
|
|
*/ |
|
|
|
|
forceShowLeftItems?: boolean; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** @alpha */ |
|
|
|
@ -44,13 +49,14 @@ export const PageToolbar = React.memo( |
|
|
|
|
/** main nav-container aria-label **/ |
|
|
|
|
'aria-label': ariaLabel, |
|
|
|
|
buttonOverflowAlignment = 'right', |
|
|
|
|
forceShowLeftItems = false, |
|
|
|
|
}: Props) => { |
|
|
|
|
const styles = useStyles2(getStyles); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* .page-toolbar css class is used for some legacy css view modes (TV/Kiosk) and |
|
|
|
|
* media queries for mobile view when toolbar needs left padding to make room |
|
|
|
|
* for mobile menu icon. This logic hopefylly can be changed when we move to a full react |
|
|
|
|
* for mobile menu icon. This logic hopefully can be changed when we move to a full react |
|
|
|
|
* app and change how the app side menu & mobile menu is rendered. |
|
|
|
|
*/ |
|
|
|
|
const mainStyle = cx( |
|
|
|
@ -127,7 +133,10 @@ export const PageToolbar = React.memo( |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
{leftItems?.map((child, index) => ( |
|
|
|
|
<div className={styles.leftActionItem} key={index}> |
|
|
|
|
<div |
|
|
|
|
className={cx(styles.leftActionItem, { [styles.forceShowLeftActionItems]: forceShowLeftItems })} |
|
|
|
|
key={index} |
|
|
|
|
> |
|
|
|
|
{child} |
|
|
|
|
</div> |
|
|
|
|
))} |
|
|
|
@ -236,11 +245,14 @@ const getStyles = (theme: GrafanaTheme2) => { |
|
|
|
|
`,
|
|
|
|
|
leftActionItem: css` |
|
|
|
|
display: none; |
|
|
|
|
align-items: center; |
|
|
|
|
padding-right: ${spacing(0.5)}; |
|
|
|
|
${theme.breakpoints.up('md')} { |
|
|
|
|
align-items: center; |
|
|
|
|
display: flex; |
|
|
|
|
padding-right: ${spacing(0.5)}; |
|
|
|
|
} |
|
|
|
|
`,
|
|
|
|
|
forceShowLeftActionItems: css` |
|
|
|
|
display: flex; |
|
|
|
|
`,
|
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|