[DRAFT] Drawer Filters

Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2021-07-13 20:33:33 +02:00
parent 45b5fc3a83
commit 2934eb3a50
14 changed files with 269 additions and 164 deletions
@@ -59,10 +59,10 @@ const useStyles = (props: ContentHeaderProps) =>
type DefaultTitleProps = {
title?: string;
className: string;
className?: string;
};
const DefaultTitle = ({
export const ContentHeaderTitle = ({
title = 'Unknown page',
className,
}: DefaultTitleProps) => (
@@ -95,7 +95,7 @@ export const ContentHeader = ({
const renderedTitle = TitleComponent ? (
<TitleComponent />
) : (
<DefaultTitle title={title} className={classes.title} />
<ContentHeaderTitle title={title} className={classes.title} />
);
return (
<Fragment>
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { ContentHeader } from './ContentHeader';
export { ContentHeader, ContentHeaderTitle } from './ContentHeader';
@@ -23,7 +23,7 @@ export interface IProps extends HeaderProps {
themeId: string;
}
export const Layout = ({
export const PageWithHeader = ({
themeId,
children,
...props
@@ -15,3 +15,4 @@
*/
export { Page } from './Page';
export { PageWithHeader } from './PageWithHeader';
@@ -1,77 +0,0 @@
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { Grid } from '@material-ui/core';
import { Content, ContentHeader, SupportButton, Button } from '../..';
import { Layout, IProps as LayoutProps } from './Layout';
import { Link as RouterLink } from 'react-router-dom';
interface ILinkProps {
contentLink?: string;
contentLinkText?: string;
}
type IProps = LayoutProps &
ILinkProps & {
contentTitle: string;
supportMessage: string;
filter: React.ReactNode;
};
const TablePageLink = ({ contentLink, contentLinkText }: ILinkProps) => {
return contentLink && contentLinkText ? (
<Button
component={RouterLink}
variant="contained"
color="primary"
to={contentLink}
>
{contentLinkText}
</Button>
) : null;
};
export const TablePage = ({
supportMessage,
filter,
children,
contentTitle,
contentLink,
contentLinkText,
...props
}: React.PropsWithChildren<IProps>) => (
<Layout {...props}>
<Content>
<ContentHeader title={contentTitle}>
<TablePageLink
contentLink={contentLink}
contentLinkText={contentLinkText}
/>
<SupportButton>{supportMessage}</SupportButton>
</ContentHeader>
<Grid container spacing={2}>
<Grid item xs={12} sm={12} lg={2}>
{filter}
</Grid>
<Grid item xs={12} sm={12} lg={10}>
{children}
</Grid>
</Grid>
</Content>
</Layout>
);
@@ -1,17 +0,0 @@
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { TablePage } from './TablePage';
@@ -29,4 +29,3 @@ export * from './Sidebar';
export * from './SignInPage';
export * from './TabbedCard';
export * from './Breadcrumbs';
export * from './TablePage';