From 82124f1837a43a9e3826de36489789fb5b84cc65 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Fri, 15 Apr 2022 16:39:17 +0200 Subject: [PATCH] Fix subheader positioning Signed-off-by: Eric Peterson --- .../TechDocsReaderPageSubheader.tsx | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx b/plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx index 62d64fa858..1eeb713ed9 100644 --- a/plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx +++ b/plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx @@ -16,26 +16,33 @@ import React from 'react'; -import { Box, Toolbar, ToolbarProps, withStyles } from '@material-ui/core'; +import { Box, makeStyles, Toolbar, ToolbarProps } from '@material-ui/core'; import { TechDocsAddonLocations as locations, useTechDocsAddons, } from '@backstage/plugin-techdocs-react'; -/** - * Renders the reader page subheader. - * Please use the Tech Docs add-ons to customize it - * @public - */ -export const TechDocsReaderPageSubheader = withStyles(theme => ({ +const useStyles = makeStyles(theme => ({ root: { gridArea: 'pageSubheader', flexDirection: 'column', minHeight: 'auto', padding: theme.spacing(3, 3, 0), }, -}))(({ toolbarProps }: { toolbarProps?: ToolbarProps }) => { +})); + +/** + * Renders the reader page subheader. + * Please use the Tech Docs add-ons to customize it + * @public + */ +export const TechDocsReaderPageSubheader = ({ + toolbarProps, +}: { + toolbarProps?: ToolbarProps; +}) => { + const classes = useStyles(); const addons = useTechDocsAddons(); const subheaderAddons = addons.renderComponentsByLocation( locations.Subheader, @@ -44,7 +51,7 @@ export const TechDocsReaderPageSubheader = withStyles(theme => ({ if (!subheaderAddons) return null; return ( - + {subheaderAddons && ( ({ )} ); -}); +};