Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit 34f0a77

Browse files
authored
fix: Make styles of input controls less dependent on global app styles (#54)
1 parent 1bda05b commit 34f0a77

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const theme = {
3232
foreground: 'white',
3333
gray: '#3f4e60',
3434
grayAlt: '#222e3e',
35+
inputBackgroundColor: '#fff',
36+
inputTextColor: '#000',
3537
success: '#00ab52',
3638
danger: '#ff0085',
3739
active: '#006bff',

src/styledComponents.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,19 @@ export const Code = styled('code', {
4848
fontSize: '.9em',
4949
})
5050

51-
export const Input = styled('input', {
51+
export const Input = styled('input', (props, theme) => ({
52+
backgroundColor: theme.inputBackgroundColor,
5253
border: 0,
5354
borderRadius: '.2em',
55+
color: theme.inputTextColor,
5456
fontSize: '.9em',
57+
lineHeight: `1.3`,
5558
padding: '.3em .4em',
56-
})
59+
}))
5760

5861
export const Select = styled(
5962
'select',
60-
{
63+
(props, theme) => ({
6164
display: `inline-block`,
6265
fontSize: `.9em`,
6366
fontFamily: `sans-serif`,
@@ -69,12 +72,13 @@ export const Select = styled(
6972
borderRadius: `.2em`,
7073
appearance: `none`,
7174
WebkitAppearance: 'none',
72-
backgroundColor: `#fff`,
75+
backgroundColor: theme.inputBackgroundColor,
7376
backgroundImage: `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>")`,
7477
backgroundRepeat: `no-repeat`,
7578
backgroundPosition: `right .55em center`,
7679
backgroundSize: `.65em auto, 100%`,
77-
},
80+
color: theme.inputTextColor,
81+
}),
7882
{
7983
'(max-width: 500px)': {
8084
display: 'none',

0 commit comments

Comments
 (0)