2021-01-17 12:54:49 -08:00
|
|
|
import * as React from 'react';
|
2021-03-07 11:26:47 -08:00
|
|
|
import { Col, Row, Divider, Layout, Space } from 'antd';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
|
2021-01-17 12:54:49 -08:00
|
|
|
import { RoutedTabs } from './RoutedTabs';
|
2021-03-07 11:26:47 -08:00
|
|
|
import { GlobalTags } from '../../types.generated';
|
|
|
|
import TagGroup from './TagGroup';
|
2021-01-17 12:54:49 -08:00
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
export interface EntityProfileProps {
|
2021-01-17 12:54:49 -08:00
|
|
|
title: string;
|
2021-03-07 11:26:47 -08:00
|
|
|
tags?: GlobalTags;
|
2021-02-09 19:05:50 -08:00
|
|
|
header: React.ReactNode;
|
2021-01-17 12:54:49 -08:00
|
|
|
tabs?: Array<{
|
|
|
|
name: string;
|
|
|
|
path: string;
|
|
|
|
content: React.ReactNode;
|
|
|
|
}>;
|
|
|
|
}
|
|
|
|
|
2021-03-07 11:26:47 -08:00
|
|
|
const TagsContainer = styled.div`
|
|
|
|
margin-top: -8px;
|
|
|
|
`;
|
|
|
|
|
2021-01-17 12:54:49 -08:00
|
|
|
const defaultProps = {
|
|
|
|
tags: [],
|
|
|
|
tabs: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-02-03 11:49:51 -08:00
|
|
|
* A default container view for presenting Entity details.
|
2021-01-17 12:54:49 -08:00
|
|
|
*/
|
2021-02-09 19:05:50 -08:00
|
|
|
export const EntityProfile = ({ title, tags, header, tabs }: EntityProfileProps) => {
|
|
|
|
const defaultTabPath = tabs && tabs?.length > 0 ? tabs[0].path : '';
|
2021-01-17 12:54:49 -08:00
|
|
|
|
|
|
|
/* eslint-disable spaced-comment */
|
|
|
|
return (
|
2021-03-09 23:14:52 -08:00
|
|
|
<Layout.Content style={{ padding: '0px 100px' }}>
|
2021-01-17 12:54:49 -08:00
|
|
|
<Row style={{ padding: '20px 0px 10px 0px' }}>
|
|
|
|
<Col span={24}>
|
2021-03-07 11:26:47 -08:00
|
|
|
<Space>
|
|
|
|
<h1>{title}</h1>
|
|
|
|
<TagsContainer>
|
|
|
|
<TagGroup globalTags={tags} />
|
|
|
|
</TagsContainer>
|
|
|
|
</Space>
|
2021-01-17 12:54:49 -08:00
|
|
|
</Col>
|
|
|
|
</Row>
|
2021-02-09 19:05:50 -08:00
|
|
|
{header}
|
2021-01-17 12:54:49 -08:00
|
|
|
<Divider style={{ marginBottom: '0px' }} />
|
|
|
|
<Row style={{ padding: '0px 0px 10px 0px' }}>
|
|
|
|
<Col span={24}>
|
2021-02-09 19:05:50 -08:00
|
|
|
<RoutedTabs defaultPath={defaultTabPath} tabs={tabs || []} />
|
2021-01-17 12:54:49 -08:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</Layout.Content>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
EntityProfile.defaultProps = defaultProps;
|