-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d08904
commit ac77446
Showing
21 changed files
with
10,579 additions
and
4,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
build-storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const path = require('path'); | ||
|
||
const toPath = (_path) => path.join(process.cwd(), _path); | ||
|
||
module.exports = { | ||
staticDirs: ['../public'], | ||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/preset-create-react-app', | ||
], | ||
core: { | ||
builder: { | ||
name: 'webpack5', | ||
}, | ||
}, | ||
webpackFinal: async (config) => { | ||
return { | ||
...config, | ||
resolve: { | ||
...config.resolve, | ||
alias: { | ||
...config.resolve.alias, | ||
'@emotion/core': toPath('node_modules/@emotion/react'), | ||
'emotion-theming': toPath('node_modules/@emotion/react'), | ||
}, | ||
}, | ||
}; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<link | ||
href="https://fonts.googleapis.com/css?family=Nunito+Sans:400,700,800,900&display=swap" | ||
rel="stylesheet" | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { ChakraProvider } from '@chakra-ui/react'; | ||
import { theme } from '../src/theme'; | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
backgrounds: { | ||
default: 'blue', | ||
values: [ | ||
{ name: 'blue', value: '#2cc5d2' }, | ||
{ name: 'white', value: '#fff' }, | ||
], | ||
}, | ||
}; | ||
|
||
export const decorators = [ | ||
(Story) => ( | ||
<ChakraProvider theme={theme}> | ||
<Story /> | ||
</ChakraProvider> | ||
), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Box, Heading } from '@chakra-ui/react'; | ||
import { Icon } from '@chakra-ui/react'; | ||
import { TaskList } from './components/TaskList'; | ||
import { EmptyState } from './components/EmptyState'; | ||
import { useTasks } from './useTasks'; | ||
|
||
const FrownIcon = (props) => ( | ||
<Icon | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
stroke="currentColor" | ||
strokeWidth={2} | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
{...props} | ||
> | ||
<circle cx="12" cy="12" r="10"></circle> | ||
<path d="M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01" /> | ||
</Icon> | ||
); | ||
|
||
export const InboxScreen = ({ error }) => { | ||
const [tasks, dispatch] = useTasks(); | ||
|
||
const archiveTask = (archive, id) => { | ||
dispatch({ type: archive ? 'ARCHIVE_TASK' : 'INBOX_TASK', id }); | ||
}; | ||
|
||
const togglePinTask = (state, id) => { | ||
dispatch({ type: state === 'TASK_PINNED' ? 'INBOX_TASK' : 'PIN_TASK', id }); | ||
}; | ||
|
||
const editTitle = (title, id) => { | ||
dispatch({ type: 'EDIT_TITLE', id, title }); | ||
}; | ||
|
||
if (error) { | ||
return ( | ||
<EmptyState | ||
h="75vh" | ||
Icon={FrownIcon} | ||
title="Oh no!" | ||
subtitle="Something went wrong" | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<Box p={4} bg="brand.300"> | ||
<Box as="nav" bg="brand.200" py={6} px={5}> | ||
<Heading | ||
as="h1" | ||
fontSize="lg" | ||
lineHeight="8" | ||
color="brand.500" | ||
textAlign={['center', 'center', 'left']} | ||
> | ||
Taskbox | ||
</Heading> | ||
</Box> | ||
<TaskList | ||
tasks={tasks} | ||
onArchiveTask={archiveTask} | ||
onTogglePinTask={togglePinTask} | ||
onEditTitle={editTitle} | ||
/> | ||
</Box> | ||
); | ||
}; | ||
|
||
InboxScreen.propTypes = { | ||
error: PropTypes.string, | ||
}; | ||
|
||
InboxScreen.defaultProps = { | ||
error: null, | ||
}; |
Oops, something went wrong.