File tree 5 files changed +95
-3
lines changed
5 files changed +95
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ const Button = css`
13
13
padding : 10px 20px ;
14
14
`
15
15
16
+ const Input = css `
17
+ border : 1px solid rgba (255 , 255 , 255 , 0.3 );
18
+ padding : 10px 20px ;
19
+ `
20
+
16
21
const theme = {
17
22
media : {
18
23
sm : '(max-width: 600px)' ,
@@ -79,6 +84,12 @@ const theme = {
79
84
background : 'royalblue' ,
80
85
color : 'white'
81
86
}
87
+ } ,
88
+ Input,
89
+ inputStyle : {
90
+ default : {
91
+ background : '#2e3440' ,
92
+ }
82
93
}
83
94
}
84
95
Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Input
3
+ route : /input
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 { Input , Link } from ' ../src'
12
+
13
+ # Input
14
+
15
+ ## Description
16
+
17
+ Based on [ Box] ( /box ) . Renders ` <input> ` or ` <textarea> ` element.
18
+
19
+
20
+ ## Usage
21
+
22
+ ``` js
23
+ import { Input } from ' pss-components'
24
+ ```
25
+
26
+ <Playground >
27
+ <Input defaultValue = ' Input' />
28
+ <Input defaultValue = ' Input' variant = ' auto' mt = { 1 } />
29
+ <Input defaultValue = ' Input' bg = ' red' mt = { 1 } />
30
+ </Playground >
31
+
32
+ ## Examples
33
+
34
+ ### Change element
35
+
36
+ <Playground >
37
+ <Input as = ' textarea' defaultValue = ' TextArea' variant = ' auto' rows = { 3 } />
38
+ </Playground >
39
+
40
+
41
+ ## Props
42
+
43
+ <PropsTable of = { Input } />
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { themePath, variant } from 'pss'
3
3
import { getPropTypes } from 'pss/prop-type'
4
4
import { Box } from './box'
5
5
6
- const buttonVariant = variant ( {
6
+ const buttonStyle = variant ( {
7
7
themeKey : 'buttonStyle'
8
8
} )
9
9
@@ -19,13 +19,13 @@ const Button = styled(Box)(
19
19
}
20
20
} ,
21
21
themePath ( 'Button' ) ,
22
- buttonVariant
22
+ buttonStyle
23
23
)
24
24
25
25
Button . displayName = 'Button'
26
26
27
27
Button . propTypes = {
28
- ...getPropTypes ( buttonVariant ) ,
28
+ ...getPropTypes ( buttonStyle ) ,
29
29
...Box . propTypes
30
30
}
31
31
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ export { Feed } from './feed'
4
4
export { Flex } from './flex'
5
5
export { FlexGrid } from './flex-grid'
6
6
export { Grid } from './grid'
7
+ export { Input } from './input'
7
8
export { Image } from './image'
8
9
export { Layout } from './layout'
9
10
export { Link } from './link'
Original file line number Diff line number Diff line change
1
+ import styled from '@emotion/styled'
2
+ import { themePath , variant } from 'pss'
3
+ import { getPropTypes } from 'pss/prop-type'
4
+ import { Box } from './box'
5
+
6
+ const inputStyle = variant ( {
7
+ themeKey : 'inputStyle'
8
+ } )
9
+
10
+ const Input = styled ( Box ) (
11
+ {
12
+ appearance : 'none' ,
13
+ '&[disabled]' : {
14
+ '-webkit-text-fill-color' : 'currentColor' ,
15
+ '-webkit-opacity' : 1
16
+ }
17
+ } ,
18
+ themePath ( 'Input' ) ,
19
+ inputStyle
20
+ )
21
+
22
+ Input . displayName = 'Input'
23
+
24
+ Input . propTypes = {
25
+ ...getPropTypes ( inputStyle ) ,
26
+ ...Box . propTypes
27
+ }
28
+
29
+ Input . defaultProps = {
30
+ as : 'input' ,
31
+ width : '100%' ,
32
+ borderRadius : 0
33
+ }
34
+
35
+ export {
36
+ Input
37
+ }
You can’t perform that action at this time.
0 commit comments