Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ module.exports = {
stories: ['./stories/**/*.@(js|jsx|ts|tsx|mdx)'],
addons: ['@storybook/addon-docs', '@storybook/addon-links'],

// due to storybook composition, chakra shows up as stories
// https://github.com/chakra-ui/chakra-ui/issues/2263#issuecomment-767557426
refs: {
'@chakra-ui/react': { disable: true },
},

webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
Expand Down
98 changes: 52 additions & 46 deletions .storybook/stories/Features/select.story.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as React from 'react';
import { storiesOf } from '@storybook/react';

import MaterialCheckbox from '@material-ui/core/Checkbox';
import { createTheme as createMaterialTheme } from '@mui/material/styles';
import { ThemeProvider as MaterialThemeProvider } from '@mui/material/styles';
import MaterialCheckbox from '@mui/material/Checkbox';

import {
Table,
Expand Down Expand Up @@ -523,54 +525,58 @@ storiesOf('Features/Select', module)
}

return (
<Table data={data} select={select}>
{(tableList) => (
<>
<Header>
<HeaderRow>
<HeaderCell stiff>
<MaterialCheckbox
size="small"
checked={select.state.all}
indeterminate={!select.state.all && !select.state.none}
onChange={select.fns.onToggleAll}
/>
</HeaderCell>
<HeaderCell>Task</HeaderCell>
<HeaderCell>Deadline</HeaderCell>
<HeaderCell>Type</HeaderCell>
<HeaderCell>Complete</HeaderCell>
<HeaderCell>Tasks</HeaderCell>
</HeaderRow>
</Header>

<Body>
{tableList.map((item) => (
<Row key={item.id} item={item}>
<Cell stiff>
<MaterialThemeProvider theme={createMaterialTheme({})}>
<Table data={data} select={select}>
{(tableList) => (
<>
<Header>
<HeaderRow>
<HeaderCell stiff>
<MaterialCheckbox
inputProps={{ 'aria-label': 'select all' }}
size="small"
checked={select.state.ids.includes(item.id)}
onChange={() => select.fns.onToggleById(item.id)}
checked={select.state.all}
indeterminate={!select.state.all && !select.state.none}
onChange={select.fns.onToggleAll}
/>
</Cell>
<Cell>{item.name}</Cell>
<Cell>
{item.deadline.toLocaleDateString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
})}
</Cell>
<Cell>{item.type}</Cell>
<Cell>{item.isComplete.toString()}</Cell>
<Cell>{item.nodes?.length}</Cell>
</Row>
))}
</Body>
</>
)}
</Table>
</HeaderCell>
<HeaderCell>Task</HeaderCell>
<HeaderCell>Deadline</HeaderCell>
<HeaderCell>Type</HeaderCell>
<HeaderCell>Complete</HeaderCell>
<HeaderCell>Tasks</HeaderCell>
</HeaderRow>
</Header>

<Body>
{tableList.map((item) => (
<Row key={item.id} item={item}>
<Cell stiff>
<MaterialCheckbox
inputProps={{ 'aria-label': 'select item' }}
size="small"
checked={select.state.ids.includes(item.id)}
onChange={() => select.fns.onToggleById(item.id)}
/>
</Cell>
<Cell>{item.name}</Cell>
<Cell>
{item.deadline.toLocaleDateString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
})}
</Cell>
<Cell>{item.type}</Cell>
<Cell>{item.isComplete.toString()}</Cell>
<Cell>{item.nodes?.length}</Cell>
</Row>
))}
</Body>
</>
)}
</Table>
</MaterialThemeProvider>
);
})
.add('documentation', () => (
Expand Down
208 changes: 106 additions & 102 deletions .storybook/stories/Features/sort.story.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import * as React from 'react';
import { storiesOf } from '@storybook/react';

import UnfoldMoreOutlinedIcon from '@material-ui/icons/UnfoldMoreOutlined';
import KeyboardArrowUpOutlinedIcon from '@material-ui/icons/KeyboardArrowUpOutlined';
import KeyboardArrowDownOutlinedIcon from '@material-ui/icons/KeyboardArrowDownOutlined';
import Button from '@material-ui/core/Button';
import UnfoldMoreOutlinedIcon from '@mui/icons-material/UnfoldMoreOutlined';
import KeyboardArrowUpOutlinedIcon from '@mui/icons-material/KeyboardArrowUpOutlined';
import KeyboardArrowDownOutlinedIcon from '@mui/icons-material/KeyboardArrowDownOutlined';
import { createTheme as createMaterialTheme } from '@mui/material/styles';
import { ThemeProvider as MaterialThemeProvider } from '@mui/material/styles';
import Button from '@mui/material/Button';

import {
Table,
Expand Down Expand Up @@ -448,104 +450,106 @@ storiesOf('Features/Sort', module)
};

return (
<Table data={data} sort={sort}>
{(tableList) => (
<>
<Header>
<HeaderRow>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('TASK')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'TASK',
})
}
>
Task
</Button>
</HeaderCell>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('DEADLINE')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'DEADLINE',
})
}
>
Deadline
</Button>
</HeaderCell>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('TYPE')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'TYPE',
})
}
>
Type
</Button>
</HeaderCell>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('COMPLETE')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'COMPLETE',
})
}
>
Complete
</Button>
</HeaderCell>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('TASKS')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'TASKS',
})
}
>
Tasks
</Button>
</HeaderCell>
</HeaderRow>
</Header>

<Body>
{tableList.map((item) => (
<Row item={item} key={item.id}>
<Cell>{item.name}</Cell>
<Cell>
{item.deadline.toLocaleDateString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
})}
</Cell>
<Cell>{item.type}</Cell>
<Cell>{item.isComplete.toString()}</Cell>
<Cell>{item.nodes?.length}</Cell>
</Row>
))}
</Body>
</>
)}
</Table>
<MaterialThemeProvider theme={createMaterialTheme({})}>
<Table data={data} sort={sort}>
{(tableList) => (
<>
<Header>
<HeaderRow>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('TASK')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'TASK',
})
}
>
Task
</Button>
</HeaderCell>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('DEADLINE')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'DEADLINE',
})
}
>
Deadline
</Button>
</HeaderCell>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('TYPE')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'TYPE',
})
}
>
Type
</Button>
</HeaderCell>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('COMPLETE')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'COMPLETE',
})
}
>
Complete
</Button>
</HeaderCell>
<HeaderCell>
<Button
fullWidth
style={{ justifyContent: 'flex-start' }}
endIcon={getIcon('TASKS')}
onClick={() =>
sort.fns.onToggleSort({
sortKey: 'TASKS',
})
}
>
Tasks
</Button>
</HeaderCell>
</HeaderRow>
</Header>

<Body>
{tableList.map((item) => (
<Row item={item} key={item.id}>
<Cell>{item.name}</Cell>
<Cell>
{item.deadline.toLocaleDateString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
})}
</Cell>
<Cell>{item.type}</Cell>
<Cell>{item.isComplete.toString()}</Cell>
<Cell>{item.nodes?.length}</Cell>
</Row>
))}
</Body>
</>
)}
</Table>
</MaterialThemeProvider>
);
})
.add('documentation', () => (
Expand Down
6 changes: 3 additions & 3 deletions .storybook/stories/Features/tree.story.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { storiesOf } from '@storybook/react';

import FolderIcon from '@material-ui/icons/Folder';
import FolderOpenIcon from '@material-ui/icons/FolderOpen';
import InsertDriveFileOutlinedIcon from '@material-ui/icons/InsertDriveFileOutlined';
import FolderIcon from '@mui/icons-material/Folder';
import FolderOpenIcon from '@mui/icons-material/FolderOpen';
import InsertDriveFileOutlinedIcon from '@mui/icons-material/InsertDriveFileOutlined';

import {
Table,
Expand Down
Loading