File tree 4 files changed +97
-1
lines changed
4 files changed +97
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ const Link = css`
8
8
}
9
9
`
10
10
11
+ const Button = css `
12
+ border-radius : 5px ;
13
+ padding : 10px 20px ;
14
+ `
15
+
11
16
const theme = {
12
17
media : {
13
18
sm : '(max-width: 600px)' ,
@@ -67,7 +72,14 @@ const theme = {
67
72
fontWeight : 'bold'
68
73
}
69
74
} ,
70
- Link
75
+ Link,
76
+ Button,
77
+ buttonVariant : {
78
+ default : {
79
+ background : 'royalblue' ,
80
+ color : 'white'
81
+ }
82
+ }
71
83
}
72
84
73
85
const themeWithRems = {
Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Button
3
+ route : /button
4
+ menu : Primitives
5
+ ---
6
+
7
+ import { Playground } from ' docz'
8
+ import { ThemeProvider } from ' emotion-theming'
9
+ import { PropsTable } from ' ../.internal/props-table'
10
+ import { theme } from ' ../.internal/theme'
11
+ import { Button , Link } from ' ../src'
12
+
13
+ # Button
14
+
15
+ ## Description
16
+
17
+ Based on [ Box] ( /box ) . Renders ` <button> ` element.
18
+
19
+
20
+ ## Usage
21
+
22
+ ``` js
23
+ import { Button } from ' pss-components'
24
+ ```
25
+
26
+ <Playground >
27
+ <Button >Button</Button >
28
+ <Button variant = ' auto' >Button</Button >
29
+ <Button bg = ' red' ml = { 1 } >Button</Button >
30
+ </Playground >
31
+
32
+ ## Examples
33
+
34
+ ### Change element
35
+
36
+ <Playground >
37
+ <Button variant = ' auto' use = ' a' href = ' http://example.com' target = ' _blank' >
38
+ Button
39
+ </Button >
40
+ </Playground >
41
+
42
+
43
+ ## Props
44
+
45
+ <PropsTable of = { Button } />
Original file line number Diff line number Diff line change
1
+ import styled from '@emotion/styled'
2
+ import { themePath , variant } from 'pss'
3
+ import { Box } from './box'
4
+
5
+ const buttonVariant = variant ( {
6
+ themeKey : 'buttonVariant'
7
+ } )
8
+
9
+ const Button = styled ( Box ) (
10
+ {
11
+ appearance : 'none' ,
12
+ textAlign : 'center' ,
13
+ textDecoration : 'none' ,
14
+ cursor : 'pointer' ,
15
+ '&[disabled]' : {
16
+ cursor : 'auto' ,
17
+ pointerEvents : 'none'
18
+ }
19
+ } ,
20
+ themePath ( 'Button' ) ,
21
+ buttonVariant
22
+ )
23
+
24
+ Button . displayName = 'Button'
25
+
26
+ Button . propTypes = {
27
+ ...buttonVariant . propTypes ,
28
+ ...Box . propTypes
29
+ }
30
+
31
+ Button . defaultProps = {
32
+ element : 'button' ,
33
+ display : 'inline-block'
34
+ }
35
+
36
+ export {
37
+ Button
38
+ }
Original file line number Diff line number Diff line change 1
1
export { Box } from './box'
2
+ export { Button } from './button'
2
3
export { Feed } from './feed'
3
4
export { Flex } from './flex'
4
5
export { FlexGrid } from './flex-grid'
You can’t perform that action at this time.
0 commit comments