@@ -3,13 +3,23 @@ import { withInfo } from "@storybook/addon-info";
33import { storiesOf } from "@storybook/react" ;
44import { action } from "@storybook/addon-actions" ;
55
6- import styled , { ThemeProvider } from "styled-components" ;
6+ import styled , { ThemeProvider } from "styled-components" ;
77
8- import { Button , Window , WindowContent , Cutout , Toolbar } from "../" ;
8+ import {
9+ Button ,
10+ Window ,
11+ WindowHeader ,
12+ WindowContent ,
13+ List ,
14+ ListItem ,
15+ Divider ,
16+ Cutout ,
17+ Toolbar
18+ } from "../" ;
919export const actions = { onClick : action ( "onClick" ) } ;
1020
1121const StyledCutout = styled ( Cutout ) `
12- background: ${ ( { theme} ) => theme . canvas } ;
22+ background: ${ ( { theme } ) => theme . canvas } ;
1323` ;
1424
1525storiesOf ( "Button" , module )
@@ -49,17 +59,11 @@ storiesOf("Button", module)
4959 💖
5060 </ Button >
5161 ) )
52- . add ( "menu button" , ( ) => (
53- < Button { ...actions } variant = "menu" size = "sm" accent >
54- File
55- </ Button >
56- ) )
62+ . add ( "menu button" , ( ) => < MenuButtonExample /> )
5763 . add ( "flat button" , ( ) => (
5864 < Window >
5965 < WindowContent >
60- < StyledCutout
61- style = { { padding : "1rem" , width : "300px" } }
62- >
66+ < StyledCutout style = { { padding : "1rem" , width : "300px" } } >
6367 < p style = { { lineHeight : 1.3 } } >
6468 When you want to use Buttons on a light background (like scrollable
6569 content), just use the flat variant:
@@ -82,3 +86,68 @@ storiesOf("Button", module)
8286 </ WindowContent >
8387 </ Window >
8488 ) ) ;
89+
90+ function MenuButtonExample ( ) {
91+ const [ open , setOpen ] = React . useState ( false ) ;
92+
93+ function handleClick ( ) {
94+ setOpen ( ! open ) ;
95+ }
96+
97+ function handleClose ( ) {
98+ setOpen ( false ) ;
99+ }
100+
101+ return (
102+ < Window style = { { maxWidth : "250px" } } >
103+ < WindowHeader > 🥝 Kiwi.app</ WindowHeader >
104+ < Toolbar noPadding >
105+ < Button variant = "menu" disabled >
106+ Upload
107+ </ Button >
108+ < Button variant = "menu" disabled >
109+ Save
110+ </ Button >
111+ < div
112+ style = { {
113+ position : "relative" ,
114+ display : "inline-block" ,
115+ alignSelf : "left"
116+ } }
117+ >
118+ { open && (
119+ < List
120+ style = { { zIndex : "9999" } }
121+ horizontalAlign = "right"
122+ verticalAlign = "bottom"
123+ open = { open }
124+ onClick = { handleClose }
125+ >
126+ < ListItem size = "sm" > Copy link</ ListItem >
127+ < Divider />
128+ < ListItem size = "sm" > Facebook</ ListItem >
129+ < ListItem size = "sm" > Twitter</ ListItem >
130+ < ListItem size = "sm" > Instagram</ ListItem >
131+ < Divider />
132+ < ListItem size = "sm" disabled >
133+ MySpace
134+ </ ListItem >
135+ </ List >
136+ ) }
137+ < Button variant = "menu" onClick = { handleClick } size = "sm" active = { open } >
138+ Share
139+ </ Button >
140+ </ div >
141+ </ Toolbar >
142+ < WindowContent style = { { padding : "0.25rem" } } >
143+ < Cutout >
144+ < img
145+ style = { { width : "100%" , height : "1uto" , display : "block" } }
146+ src = "https://image.freepik.com/foto-gratuito/la-frutta-fresca-del-kiwi-tagliata-a-meta-con-la-decorazione-completa-del-pezzo-e-bella-sulla-tavola-di-legno_47436-1.jpg"
147+ alt = "kiwi"
148+ />
149+ </ Cutout >
150+ </ WindowContent >
151+ </ Window >
152+ ) ;
153+ }
0 commit comments