diff --git a/src/stories/bundles/app.stories.tsx b/src/stories/bundles/app.stories.tsx
index bf55761..58bc897 100644
--- a/src/stories/bundles/app.stories.tsx
+++ b/src/stories/bundles/app.stories.tsx
@@ -1,19 +1,61 @@
-import { useEffect } from 'react'
+import { ReactElement, useEffect, useState } from 'react'
+import {
+ Avatar,
+ Button,
+ IconButton,
+ MenuItem,
+ Progress,
+ Switch,
+ Link as ChakraLink,
+ useDisclosure,
+ Tabs,
+ TabList,
+ Tab,
+} from '@chakra-ui/react'
+import {
+ AccountMenu,
+ AppBar,
+ AuxiliaryDrawer,
+ DataTable,
+ Form,
+ IconAdd,
+ IconAdminPanelSettings,
+ IconChat,
+ IconDelete,
+ IconEdit,
+ IconFavorite,
+ IconFlag,
+ IconGroup,
+ IconLogout,
+ IconStacks,
+ IconTune,
+ IconUpload,
+ IconWorkspaces,
+ Logo,
+ NumberTag,
+ PagePagination,
+ SearchBar,
+ Shell,
+ usePagePagination,
+} from '@koupr/ui'
import { Meta, StoryObj } from '@storybook/react'
-import { Route, Routes, useLocation, useNavigate } from 'react-router-dom'
-import { Layout } from '../common/layout'
-import { List } from '../common/list'
-import { Page } from '../common/page'
-import { ParagraphGroups, ParagraphOrganizations } from '../common/paragraphs'
-import { Settings } from '../common/settings'
-
-export const App = () => {
+import cx from 'classnames'
+import {
+ Link,
+ Outlet,
+ Route,
+ Routes,
+ useLocation,
+ useNavigate,
+} from 'react-router-dom'
+
+const App = () => {
const location = useLocation()
const navigate = useNavigate()
useEffect(() => {
if (location.pathname === '/workspace') {
- navigate('/workspace/list')
+ navigate('/workspace/data-table')
}
}, [location.pathname, navigate])
@@ -25,28 +67,403 @@ export const App = () => {
element={}
children={
<>
- } />
- } />
+ }
+ />
+ } />
>
}
/>
- } />
- } />
+
+ Commodo volutpat facilisis habitant; mattis ultrices mauris ex
+ nisi. Consequat nascetur lacus sed fames convallis pretium sit
+ justo. Gravida curabitur condimentum hac mi, ridiculus montes.
+ Eros commodo porttitor erat amet primis imperdiet. Morbi at
+ potenti volutpat litora viverra dapibus sapien. Fermentum sodales
+ nullam aliquam fusce aliquam.
+
+ }
+ />
+
+ Dis eros primis condimentum a porttitor orci curabitur. Aluctus
+ arcu blandit dui facilisi interdum pretium tristique. Cras nam
+ congue parturient posuere tempor lectus? Felis hendrerit penatibus
+ semper maximus convallis tortor. Et potenti quisque ex phasellus
+ magnis leo netus. Hac enim ante curae odio libero feugiat metus
+ conubia tincidunt.
+
+ }
+ />
)
}
+type LayoutProps = {
+ children?: ReactElement
+}
+
+const Layout = ({ children }: LayoutProps) => {
+ const location = useLocation()
+ const navigate = useNavigate()
+ const tasks = useDisclosure()
+ const uploads = useDisclosure()
+ const [query, setQuery] = useState('')
+
+ useEffect(() => {
+ if (location.pathname === '/') {
+ navigate('/workspace')
+ }
+ }, [navigate])
+
+ return (
+ }
+ topBar={
+ }
+ title="Search filters"
+ aria-label="Search filters"
+ />
+ }
+ onSearch={setQuery}
+ onClear={() => setQuery('')}
+ />
+ }
+ buttons={
+ <>
+ }
+ variant="solid"
+ colorScheme="blue"
+ >
+ New Workspace
+
+ }
+ title="Open console"
+ aria-label="Open console"
+ />
+ }
+ header="Uploads"
+ body={<>>}
+ isOpen={uploads.isOpen}
+ onClose={uploads.onClose}
+ onOpen={uploads.onOpen}
+ />
+ }
+ header="Tasks"
+ body={<>>}
+ hasBadge={true}
+ isOpen={tasks.isOpen}
+ onOpen={tasks.onOpen}
+ onClose={tasks.onClose}
+ />
+
+
+
+
+ >
+ }
+ />
+ >
+ }
+ />
+ }
+ items={[
+ {
+ href: '/workspace',
+ icon: ,
+ primaryText: 'Workspaces',
+ secondaryText: 'Isolated containers for files and folders.',
+ },
+ {
+ href: '/group',
+ icon: ,
+ primaryText: 'Groups',
+ secondaryText: 'Allows assigning permissions to a group of users.',
+ },
+ {
+ href: '/organization',
+ icon: ,
+ primaryText: 'Organizations',
+ secondaryText: 'Umbrellas for workspaces and users.',
+ },
+ ]}
+ pathnameFn={() => location.pathname}
+ navigateFn={navigate}
+ >
+ {children}
+
+ )
+}
+
+const Page = () => {
+ const navigate = useNavigate()
+ return (
+
+
+
+ navigate('/workspace/data-table')}>
+ Data Table
+
+ navigate('/workspace/form')}>Form
+
+
+
+
+ )
+}
+
const meta: Meta = {
title: 'Bundles/App',
component: App,
parameters: {
layout: 'fullscreen',
},
- excludeStories: /App/,
}
export default meta
type Story = StoryObj
export const Default: Story = {}
+
+type SampleItem = {
+ name: string
+ symbol: string
+ dateOfBirth: string
+}
+
+const SampleDataTable = () => {
+ const navigate = useNavigate()
+ const location = useLocation()
+ const { page, size, steps, setPage, setSize } = usePagePagination({
+ navigateFn: navigate,
+ searchFn: () => location.search,
+ })
+
+ return (
+
+ items={[
+ {
+ name: 'Bruce Wayne',
+ symbol: 'Batman',
+ dateOfBirth: '1915-04-07',
+ },
+ {
+ name: 'Tony Stark',
+ symbol: 'Iron Man',
+ dateOfBirth: '1970-05-29',
+ },
+ {
+ name: 'Steven Rogers',
+ symbol: 'Captain America',
+ dateOfBirth: '1918-07-04',
+ },
+ {
+ name: 'Clinton Barton',
+ symbol: 'Hawkeye',
+ dateOfBirth: '1975-01-01',
+ },
+ {
+ name: 'Natasha Romanoff',
+ symbol: 'Black Widow',
+ dateOfBirth: '1984-12-03',
+ },
+ ]}
+ columns={[
+ {
+ title: 'Name',
+ renderCell: (item) => (
+
+ ),
+ },
+ {
+ title: 'Symbol',
+ renderCell: (item) => {item.symbol},
+ },
+ {
+ title: 'Date of Birth',
+ renderCell: (item) => (
+ {new Date(item.dateOfBirth).toLocaleString()}
+ ),
+ },
+ ]}
+ actions={[
+ {
+ label: 'Mark As Favorite',
+ icon: ,
+ onClick: (item) => console.log(`Marking ${item.name} as favorite!`),
+ },
+ {
+ label: 'Start Conversation',
+ icon: ,
+ isDisabled: true,
+ onClick: (item) =>
+ console.log(`Starting a conversation with ${item.name}.`),
+ },
+ {
+ label: 'Remove From Organization',
+ icon: ,
+ isDestructive: true,
+ onClick: (item) =>
+ console.log(`Removing ${item.name} from organization...`),
+ },
+ ]}
+ pagination={
+
+ }
+ />
+ )
+}
+
+const SampleForm = () => (
+
)
@@ -33,3 +75,198 @@ export default meta
type Story = StoryObj
export const Default: Story = {}
+
+type SampleItem = {
+ name: string
+ symbol: string
+ dateOfBirth: string
+}
+
+const SampleDataTable = () => {
+ const navigate = useNavigate()
+ const location = useLocation()
+ const { page, size, steps, setPage, setSize } = usePagePagination({
+ navigateFn: navigate,
+ searchFn: () => location.search,
+ })
+
+ return (
+
+ items={[
+ {
+ name: 'Bruce Wayne',
+ symbol: 'Batman',
+ dateOfBirth: '1915-04-07',
+ },
+ {
+ name: 'Tony Stark',
+ symbol: 'Iron Man',
+ dateOfBirth: '1970-05-29',
+ },
+ {
+ name: 'Steven Rogers',
+ symbol: 'Captain America',
+ dateOfBirth: '1918-07-04',
+ },
+ {
+ name: 'Clinton Barton',
+ symbol: 'Hawkeye',
+ dateOfBirth: '1975-01-01',
+ },
+ {
+ name: 'Natasha Romanoff',
+ symbol: 'Black Widow',
+ dateOfBirth: '1984-12-03',
+ },
+ ]}
+ columns={[
+ {
+ title: 'Name',
+ renderCell: (item) => (
+
+ ),
+ },
+ {
+ title: 'Symbol',
+ renderCell: (item) => {item.symbol},
+ },
+ {
+ title: 'Date of Birth',
+ renderCell: (item) => (
+ {new Date(item.dateOfBirth).toLocaleString()}
+ ),
+ },
+ ]}
+ actions={[
+ {
+ label: 'Mark As Favorite',
+ icon: ,
+ onClick: (item) => console.log(`Marking ${item.name} as favorite!`),
+ },
+ {
+ label: 'Start Conversation',
+ icon: ,
+ isDisabled: true,
+ onClick: (item) =>
+ console.log(`Starting a conversation with ${item.name}.`),
+ },
+ {
+ label: 'Remove From Organization',
+ icon: ,
+ isDestructive: true,
+ onClick: (item) =>
+ console.log(`Removing ${item.name} from organization...`),
+ },
+ ]}
+ pagination={
+
+ }
+ />
+ )
+}
+
+const SampleForm = () => (
+