Skip to content

Commit 940f8f9

Browse files
committed
buttons
1 parent 931000c commit 940f8f9

File tree

4 files changed

+86
-8
lines changed

4 files changed

+86
-8
lines changed

components/Button/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,23 @@ type ButtonProps = {
77
className?: string,
88
type?: string,
99
size?: string,
10+
children: React.ReactNode
1011
}
1112

1213
/* Default Button is medium sized */
13-
export const Button: React.FunctionComponent<ButtonProps> = ({ className, type, children }) => {
14-
let classes = classnames("acm-btn", {"acm-btn-primary": type === "primary"});
14+
export const Button = ({ className, type, size, children }: ButtonProps) => {
15+
let classes = classnames("acm-btn",
16+
{
17+
"acm-btn-primary": type === "primary",
18+
"acm-btn-outline": type === "outline",
19+
"acm-btn-small": size === "small",
20+
"acm-btn-medium": size === "medium",
21+
"acm-btn-large": size === "large"
22+
}
23+
);
1524
if (className) {
1625
classes = classnames(classes, ...className.split(" "));
1726
}
18-
console.log(classes);
1927
return (
2028
<button className={classes}>
2129
<span>{children}</span>

components/Button/styles.less

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
@import "../../styles/vars.less";
2-
.acm-button {
3-
background-color: rgb(51,56,68);
2+
.acm-btn {
3+
background-color: @b1;
44
color: @white;
5+
text-align: center;
6+
display: inline-block;
7+
border-radius: 30px;
8+
margin: 5px 0;
9+
border: 2px solid transparent;
10+
cursor: pointer;
11+
transition: 200ms;
12+
line-height: 1.5;
13+
outline: none;
14+
}
15+
.acm-btn-outline {
16+
background-color: @white;
17+
color: @b1;
18+
}
19+
.acm-btn:hover {
20+
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.25);
21+
}
22+
.acm-btn-primary:hover {
23+
background-color: @white;
24+
color: @button-hover-color;
25+
border: 2px solid @b1;
26+
transform: translatey(-1px);
27+
}
28+
.acm-btn-outline:hover {
29+
border: 2px solid @white;
30+
background-color: @b1;
31+
color: @button-hover-color-dark;
32+
transform: translatey(-1px);
33+
}
34+
.acm-btn-small {
35+
width: 124px;
36+
min-height: 35px;
37+
}
38+
.acm-btn-medium {
39+
width: 220px;
40+
min-height: 35px;
41+
}
42+
.acm-btn-large {
43+
padding: 0 15px;
44+
min-width: 300px;
45+
min-height: 35px;
46+
}
47+
.acm-btn-large.acm-btn-primary:hover {
48+
opacity: 0.75;
49+
background-color: @b1;
50+
border: 2px solid @b1;
51+
color: @white;
52+
transform: translatey(-1px);
553
}

stories/button.stories.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
import { storiesOf } from "@storybook/react";
22
import * as React from "react";
33
import 'antd/dist/antd.css';
4-
import { Button } from "../";
4+
import { Button } from "../components/Button";
55

66
storiesOf("Button", module).add("All", () => (
77
<div className="storycontainer">
8-
<div className="story-module spaced">
8+
<div className="story-module spaced" style={{backgroundColor:'rgba(10,190,240, 0.25)'}}>
99
<h3>Small Buttons</h3>
1010
<Button type="primary" size="small">
1111
CLICK ME
1212
</Button>
13+
<Button type="outline" size="small">
14+
CLICK ME
15+
</Button>
16+
<h3>Medium Buttons</h3>
17+
<Button type="primary" size="medium">
18+
CLICK ME
19+
</Button>
20+
<Button type="outline" size="small">
21+
CLICK ME
22+
</Button>
23+
<h3>Large Buttons</h3>
24+
<Button type="primary" size="large">
25+
CLICK ME
26+
</Button>
27+
<Button type="outline" size="small">
28+
CLICK ME
29+
</Button>
1330
</div>
1431
</div>
1532
));

styles/vars.less

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
/** ACM COMPONENTS **/
2+
23
@white: white;
4+
@b1: #333;
5+
@button-hover-color: rgba(51, 51, 51, 0.75);
6+
@button-hover-color-dark: rgba(255, 255, 255, 0.75);
7+
@b2: #666;
38

49
/** Screen break points **/
510
@sm: 576px;
@@ -9,4 +14,4 @@
914

1015
/* Typography */
1116
@font: 'Montserrat', sans-serif;
12-
@body-font: 'Open Sans', sans-serif;
17+
@body-font: 'Open Sans', sans-serif;

0 commit comments

Comments
 (0)