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

[docs-infra] Allow to pass navigation bar banner from outside #36299

Merged
merged 2 commits into from
Feb 23, 2023
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: 3 additions & 2 deletions docs/src/modules/components/AppFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const StyledAppNavDrawer = styled(AppNavDrawer)(({ disablePermanent, theme }) =>
});

export default function AppFrame(props) {
const { children, disableDrawer = false, className } = props;
const { children, disableDrawer = false, className, BannerComponent = AppFrameBanner } = props;
const t = useTranslate();

const [mobileOpen, setMobileOpen] = React.useState(false);
Expand Down Expand Up @@ -200,7 +200,7 @@ export default function AppFrame(props) {
</NextLink>
<GrowingDiv />
<Stack direction="row" spacing="10px">
<AppFrameBanner />
<BannerComponent />
<DeferredAppSearch />
<Tooltip title={t('appFrame.github')} enterDelay={300}>
<IconButton
Expand Down Expand Up @@ -235,6 +235,7 @@ export default function AppFrame(props) {
}

AppFrame.propTypes = {
BannerComponent: PropTypes.elementType,
children: PropTypes.node.isRequired,
className: PropTypes.string,
disableDrawer: PropTypes.bool,
Expand Down
4 changes: 3 additions & 1 deletion docs/src/modules/components/AppLayoutDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const ActionsDiv = styled('div')(({ theme }) => ({
function AppLayoutDocs(props) {
const router = useRouter();
const {
BannerComponent,
children,
description,
disableAd = false,
Expand Down Expand Up @@ -101,7 +102,7 @@ function AppLayoutDocs(props) {
}

return (
<AppFrame>
<AppFrame BannerComponent={BannerComponent}>
<GlobalStyles
styles={{
':root': {
Expand Down Expand Up @@ -139,6 +140,7 @@ function AppLayoutDocs(props) {
}

AppLayoutDocs.propTypes = {
BannerComponent: PropTypes.elementType,
children: PropTypes.node.isRequired,
description: PropTypes.string.isRequired,
disableAd: PropTypes.bool.isRequired,
Expand Down