feat: add admin layout

This commit is contained in:
chenos 2022-01-17 23:03:51 +08:00
parent dde48fc775
commit d0f677a6e9

View File

@ -1,13 +1,31 @@
import { Table } from 'antd'; import React, { useState } from 'react';
import React from 'react'; import { Layout, Spin } from 'antd';
import { useRoute } from '../..';
import { RemoteSchemaComponent } from '../../../schema-component';
import { useHistory, useRouteMatch } from 'react-router-dom';
export function AdminLayout(props: any) { export function AdminLayout(props: any) {
const route = useRoute();
const history = useHistory();
const match = useRouteMatch<any>();
const defaultSelectedUid = match.params.name;
const [schema, setSchema] = useState({});
const onSelect = ({ item }) => {
const schema = item.props.schema;
setSchema(schema);
history.push(`/admin/${schema['x-uid']}`);
};
return ( return (
<div> <Layout>
<Table/> <Layout.Header>
AdminLayout <RemoteSchemaComponent scope={{ onSelect, defaultSelectedUid }} uid={route.uiSchemaUid} />
</div> </Layout.Header>
<Layout>
<Layout.Content>
<RemoteSchemaComponent uid={match.params.name} />
</Layout.Content>
</Layout>
</Layout>
); );
} }