forked from hexbear-collective/hexbear-frontend
6 changed files with 219 additions and 84 deletions
-
2package.json
-
3src/custom.css
-
37src/stories/Button.stories.tsx
-
74src/stories/Card.stories.tsx
-
138src/stories/Theming.stories.tsx
-
49src/theme.tsx
@ -0,0 +1,74 @@ |
|||
import React, { useState } from 'react'; |
|||
import { Box, Heading } from 'theme-ui'; |
|||
import Card from '../components/elements/Card'; |
|||
import { ThemeSystemProvider } from '../components/ThemeSystemProvider'; |
|||
import { ThemeSelector } from '../theme'; |
|||
|
|||
export default { |
|||
title: 'Card', |
|||
}; |
|||
|
|||
export const Basic = () => { |
|||
const [theme, setTheme] = useState('chapo'); |
|||
|
|||
return ( |
|||
<ThemeSystemProvider> |
|||
<Box m={4}> |
|||
<ThemeSelector |
|||
value={theme} |
|||
onChange={newTheme => setTheme(newTheme)} |
|||
/> |
|||
</Box> |
|||
<Box m={4}> |
|||
<Card> |
|||
<div className="card-body"> |
|||
<Heading as="h4"> |
|||
Trending{' '} |
|||
<a className="text-body" href="/communities"> |
|||
communities |
|||
</a> |
|||
</Heading> |
|||
<ul className="list-inline"> |
|||
<li className="list-inline-item"> |
|||
<a href="/c/nullcom">nullcom</a> |
|||
</li> |
|||
<li className="list-inline-item"> |
|||
<a href="/c/chapotraphouse">chapotraphouse</a> |
|||
</li> |
|||
<li className="list-inline-item"> |
|||
<a href="/c/mls">mls</a> |
|||
</li> |
|||
<li className="list-inline-item"> |
|||
<a href="/c/readonly_test">readonly_test</a> |
|||
</li> |
|||
<li className="list-inline-item"> |
|||
<a href="/c/dad">dad</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
<div> |
|||
<h5> |
|||
Subscribed to{' '} |
|||
<a className="text-body" href="/communities"> |
|||
communities |
|||
</a> |
|||
</h5> |
|||
<ul className="list-inline"> |
|||
<li className="list-inline-item"> |
|||
<a href="/c/bug_reports">bug_reports</a> |
|||
</li> |
|||
<li className="list-inline-item"> |
|||
<a href="/c/tacobell">tacobell</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
<div className="css-4cffwv"> |
|||
<a className="css-18q9lsw" href="/create_community"> |
|||
Create a Community |
|||
</a> |
|||
</div> |
|||
</Card> |
|||
</Box> |
|||
</ThemeSystemProvider> |
|||
); |
|||
}; |
@ -1,93 +1,101 @@ |
|||
import React, { useState } from 'react'; |
|||
import { Box, Label, |
|||
import { |
|||
Box, |
|||
Label, |
|||
Input, |
|||
Select, |
|||
Textarea, |
|||
Radio, |
|||
Flex, |
|||
Checkbox, |
|||
Slider, } from 'theme-ui'; |
|||
Slider, |
|||
Heading, |
|||
Spinner, |
|||
Badge, |
|||
Alert, |
|||
} from 'theme-ui'; |
|||
import Button from '../components/elements/Button'; |
|||
import { ThemeSystemProvider } from '../components/ThemeSystemProvider'; |
|||
import { ThemeSelector } from '../theme'; |
|||
// import { Button } from '@storybook/react/demo';
|
|||
|
|||
|
|||
export default { title: 'Themes' }; |
|||
|
|||
function Form() { |
|||
return ( |
|||
<Box |
|||
as='form' |
|||
onSubmit={e => e.preventDefault()}> |
|||
<Label htmlFor='username'>Username</Label> |
|||
<Input |
|||
name='username' |
|||
id='username' |
|||
mb={3} |
|||
/> |
|||
<Label htmlFor='password'>Password</Label> |
|||
<Input |
|||
type='password' |
|||
name='password' |
|||
id='password' |
|||
mb={3} |
|||
/> |
|||
<Box> |
|||
<Label mb={3}> |
|||
<Checkbox /> |
|||
Remember me |
|||
</Label> |
|||
</Box> |
|||
<Label htmlFor='sound'>Sound</Label> |
|||
<Select name='sound' id='sound' mb={3}> |
|||
<option>Beep</option> |
|||
<option>Boop</option> |
|||
<option>Blip</option> |
|||
</Select> |
|||
<Label htmlFor='comment'>Comment</Label> |
|||
<Textarea |
|||
name='comment' |
|||
id='comment' |
|||
rows='6' |
|||
mb={3} |
|||
/> |
|||
<Flex mb={3}> |
|||
<Label> |
|||
<Radio name='letter' /> Alpha |
|||
</Label> |
|||
<Label> |
|||
<Radio name='letter' /> Bravo |
|||
</Label> |
|||
<Label> |
|||
<Radio name='letter' /> Charlie |
|||
</Label> |
|||
</Flex> |
|||
<Label> |
|||
Slider |
|||
</Label> |
|||
<Slider mb={3} /> |
|||
<Button variant="primary"> |
|||
Submit |
|||
</Button> |
|||
<Button variant='secondary'> |
|||
Cancel |
|||
</Button> |
|||
</Box> |
|||
) |
|||
<Box as="form" onSubmit={e => e.preventDefault()}> |
|||
<Label htmlFor="username">Username</Label> |
|||
<Input name="username" id="username" mb={3} /> |
|||
<Box> |
|||
<Label mb={3}> |
|||
<Checkbox /> |
|||
Remember me |
|||
</Label> |
|||
</Box> |
|||
<Label htmlFor="comment">Comment</Label> |
|||
<Textarea name="comment" id="comment" rows="6" mb={3} /> |
|||
<Flex mb={3}> |
|||
<Label> |
|||
<Radio name="letter" /> Alpha |
|||
</Label> |
|||
<Label> |
|||
<Radio name="letter" /> Bravo |
|||
</Label> |
|||
<Label> |
|||
<Radio name="letter" /> Charlie |
|||
</Label> |
|||
</Flex> |
|||
<Label>Slider</Label> |
|||
<Slider mb={3} /> |
|||
<Button variant="primary">Submit</Button> |
|||
<Button variant="secondary">Cancel</Button> |
|||
</Box> |
|||
); |
|||
} |
|||
|
|||
const Badges = () => ( |
|||
<Box my={3}> |
|||
<Heading>Badges</Heading> |
|||
<Badge mr={2}>Badge 1</Badge> |
|||
<Badge variant="outline">Badge 2</Badge> |
|||
</Box> |
|||
); |
|||
|
|||
const Alerts = () => ( |
|||
<Box my={3}> |
|||
<Heading>Alerts</Heading> |
|||
<Alert variant="primary" mb={2}> |
|||
Primary |
|||
</Alert> |
|||
<Alert variant="secondary" mb={2}> |
|||
Secondary |
|||
</Alert> |
|||
<Alert variant="muted" mb={2}> |
|||
Muted |
|||
</Alert> |
|||
</Box> |
|||
); |
|||
|
|||
export const Basic = () => { |
|||
const [theme, setTheme] = useState('chapo'); |
|||
|
|||
return ( |
|||
<ThemeSystemProvider> |
|||
<Box m={4}> |
|||
<Box m={4} css={{ maxWidth: '700px' }}> |
|||
<Box mb={2}> |
|||
<ThemeSelector value={theme} onChange={newTheme => setTheme(newTheme)} /> |
|||
<Label>Theme</Label> |
|||
<ThemeSelector |
|||
value={theme} |
|||
onChange={newTheme => setTheme(newTheme)} |
|||
/> |
|||
</Box> |
|||
<Form /> |
|||
<Box my={3}> |
|||
<Spinner /> |
|||
<Badges /> |
|||
<Alerts /> |
|||
</Box> |
|||
</Box> |
|||
</ThemeSystemProvider> |
|||
) |
|||
}; |
|||
); |
|||
}; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue