ExampleApp.stories.jsx 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. import {
  20. Layout,
  21. Menu,
  22. Button,
  23. Card,
  24. Alert,
  25. Input,
  26. Table,
  27. Space,
  28. } from '@superset-ui/core/components';
  29. // eslint-disable-next-line import/no-extraneous-dependencies
  30. import { Icons } from '@superset-ui/core/components/Icons';
  31. const { Header, Content, Sider } = Layout;
  32. export default {
  33. title: 'Example/ExampleApp',
  34. };
  35. export const KitchenSink = () => {
  36. const columns = [
  37. { title: 'Name', dataIndex: 'name' },
  38. { title: 'Age', dataIndex: 'age' },
  39. { title: 'Address', dataIndex: 'address' },
  40. ];
  41. const data = [
  42. { key: 1, name: 'John Brown', age: 32, address: 'New York' },
  43. { key: 2, name: 'Jim Green', age: 42, address: 'London' },
  44. { key: 3, name: 'Joe Black', age: 28, address: 'Sydney' },
  45. ];
  46. return (
  47. <Layout style={{ minHeight: '100vh' }}>
  48. <Header style={{ color: 'white', fontSize: 18 }}>My App</Header>
  49. <Layout>
  50. <Sider width={200}>
  51. <Menu
  52. mode="inline"
  53. defaultSelectedKeys={['1']}
  54. style={{ height: '100%' }}
  55. items={[
  56. { key: '1', icon: <Icons.UserOutlined />, label: 'Users' },
  57. { key: '2', icon: <Icons.BookOutlined />, label: 'Devices' },
  58. { key: '3', icon: <Icons.CheckCircleFilled />, label: 'Alerts' },
  59. ]}
  60. />
  61. </Sider>
  62. <Layout style={{ padding: '24px' }}>
  63. <Content>
  64. <Space direction="vertical" size="large" style={{ width: '100%' }}>
  65. <Alert
  66. message="Welcome"
  67. description="You are logged in."
  68. type="info"
  69. />
  70. <Card title="Quick Actions">
  71. <Space>
  72. <Button type="primary">Create</Button>
  73. <Button>Settings</Button>
  74. <Input placeholder="Search..." />
  75. </Space>
  76. </Card>
  77. <Card title="User Table">
  78. <Table columns={columns} dataSource={data} pagination={false} />
  79. </Card>
  80. </Space>
  81. </Content>
  82. </Layout>
  83. </Layout>
  84. </Layout>
  85. );
  86. };