2021-01-17 12:54:49 -08:00
|
|
|
import * as React from 'react';
|
2021-03-18 11:52:14 -07:00
|
|
|
import { Col, Row, Divider, Layout, Card, Typography } from 'antd';
|
2021-03-07 11:26:47 -08:00
|
|
|
import styled from 'styled-components';
|
2021-03-18 11:52:14 -07:00
|
|
|
import { TagOutlined } from '@ant-design/icons';
|
2021-03-07 11:26:47 -08:00
|
|
|
|
2021-01-17 12:54:49 -08:00
|
|
|
import { RoutedTabs } from './RoutedTabs';
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
export interface EntityProfileProps {
|
2021-01-17 12:54:49 -08:00
|
|
|
title: string;
|
2021-03-18 11:52:14 -07:00
|
|
|
tags?: React.ReactNode;
|
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-18 11:52:14 -07:00
|
|
|
const TagsTitle = styled(Typography.Title)`
|
|
|
|
font-size: 18px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const TagCard = styled(Card)`
|
|
|
|
margin-top: 24px;
|
|
|
|
font-size: 18px;
|
2021-03-22 23:19:28 -07:00
|
|
|
min-width: 100%;
|
|
|
|
width: 100%;
|
2021-03-18 11:52:14 -07:00
|
|
|
`;
|
|
|
|
|
|
|
|
const TagIcon = styled(TagOutlined)`
|
|
|
|
padding-right: 6px;
|
2021-03-07 11:26:47 -08:00
|
|
|
`;
|
|
|
|
|
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-03-18 11:52:14 -07:00
|
|
|
<div>
|
2021-03-22 23:19:28 -07:00
|
|
|
<Row>
|
|
|
|
<Col span={16} md={16} sm={24} xs={24}>
|
|
|
|
<div>
|
|
|
|
<Row style={{ padding: '20px 0px 10px 0px' }}>
|
|
|
|
<Col span={24}>
|
|
|
|
<h1>{title}</h1>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
{header}
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
<Col span={8} xs={24} sm={24} md={8}>
|
|
|
|
<TagCard>
|
|
|
|
<TagsTitle type="secondary" level={4}>
|
|
|
|
<TagIcon /> Tags
|
|
|
|
</TagsTitle>
|
|
|
|
{tags}
|
|
|
|
</TagCard>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2021-03-18 11:52:14 -07:00
|
|
|
<Divider style={{ marginBottom: '0px' }} />
|
|
|
|
<Row style={{ padding: '0px 0px 10px 0px' }}>
|
|
|
|
<Col span={24}>
|
|
|
|
<RoutedTabs defaultPath={defaultTabPath} tabs={tabs || []} />
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</div>
|
2021-01-17 12:54:49 -08:00
|
|
|
</Layout.Content>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
EntityProfile.defaultProps = defaultProps;
|