Skip to content

Commit d3741e8

Browse files
committed
fixed menu Button active style hover issue, minor style change on WindowHeader
1 parent 01841bb commit d3741e8

File tree

3 files changed

+84
-13
lines changed

3 files changed

+84
-13
lines changed

src/components/Button/Button.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ const StyledButton = styled.button`
3838
${createBoxStyles()};
3939
border: 2px solid transparent;
4040
&:hover {
41-
${({ isDisabled }) => !isDisabled && createWellBorderStyles(false)}
41+
${({ isDisabled, active }) =>
42+
!isDisabled && !active && createWellBorderStyles(false)}
4243
}
4344
&:active {
4445
${({ isDisabled }) => !isDisabled && createWellBorderStyles(true)}
4546
}
46-
${({ active }) => active && createBorderStyles(true)}
47+
${({ active }) => active && createWellBorderStyles(true)}
4748
${({ isDisabled }) => isDisabled && createDisabledTextStyles()}
4849
`
4950
: css`

src/components/Button/Button.stories.js

Lines changed: 80 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@ import { withInfo } from "@storybook/addon-info";
33
import { storiesOf } from "@storybook/react";
44
import { 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 "../";
919
export const actions = { onClick: action("onClick") };
1020

1121
const StyledCutout = styled(Cutout)`
12-
background: ${({theme})=>theme.canvas};
22+
background: ${({ theme }) => theme.canvas};
1323
`;
1424

1525
storiesOf("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+
}

src/components/WindowHeader/WindowHeader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const SlyledWindowHeader = styled.div`
99
line-height: 33px;
1010
padding: 0 ${padding.sm};
1111
margin-right: 2px;
12+
margin-bottom: 4px;
1213
1314
font-weight: bold;
1415
color: ${({ theme }) => theme.textInvert};

0 commit comments

Comments
 (0)