forked from react95-io/React95
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppBar.stories.js
83 lines (78 loc) · 1.95 KB
/
AppBar.stories.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import React from 'react';
import styled from 'styled-components';
import {
AppBar,
Toolbar,
TextField,
Button,
List,
ListItem,
Divider
} from 'react95';
import logoIMG from '../assets/images/logo.png';
export default {
title: 'AppBar',
component: AppBar,
decorators: [story => <Wrapper>{story()}</Wrapper>]
};
const Wrapper = styled.div`
padding: 5rem;
background: ${({ theme }) => theme.desktopBackground};
`;
export const Default = () => {
const [open, setOpen] = React.useState(false);
return (
<AppBar>
<Toolbar style={{ justifyContent: 'space-between' }}>
<div style={{ position: 'relative', display: 'inline-block' }}>
<Button
onClick={() => setOpen(!open)}
active={open}
style={{ fontWeight: 'bold' }}
>
<img
src={logoIMG}
alt='react95 logo'
style={{ height: '20px', marginRight: 4 }}
/>
Start
</Button>
{open && (
<List
style={{
position: 'absolute',
left: '0',
top: '100%'
}}
onClick={() => setOpen(false)}
>
<ListItem>
<span role='img' aria-label='👨💻'>
👨💻
</span>
Profile
</ListItem>
<ListItem>
<span role='img' aria-label='📁'>
📁
</span>
My account
</ListItem>
<Divider />
<ListItem disabled>
<span role='img' aria-label='🔙'>
🔙
</span>
Logout
</ListItem>
</List>
)}
</div>
<TextField placeholder='Search...' width={150} />
</Toolbar>
</AppBar>
);
};
Default.story = {
name: 'default'
};