Skip to content

Commit 5f376a4

Browse files
committed
✨ Add reset styles to Box
1 parent 055f310 commit 5f376a4

File tree

5 files changed

+209
-23
lines changed

5 files changed

+209
-23
lines changed

src/box/index.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,19 @@ import {
1414

1515
import PropTypes from 'prop-types'
1616
import styled from '@emotion/styled'
17+
import { css } from '@emotion/core'
1718
import { createBase, blacklistOf } from '../utils'
1819

20+
const reset = css`
21+
box-sizing: border-box;
22+
min-width: 0;
23+
margin: 0;
24+
padding: 0;
25+
border: 0;
26+
`
27+
28+
const initialCSS = (props) => props.initialCSS
29+
1930
const styles = combineStyles(
2031
box,
2132
boxStyle,
@@ -34,8 +45,8 @@ const BoxBase = createBase('div', {
3445
})
3546

3647
const Box = styled(BoxBase)(
37-
{ boxSizing: 'border-box' },
38-
(props) => props.initialCSS,
48+
reset,
49+
initialCSS,
3950
styles
4051
)
4152

src/flex-list/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { FlexBox } from '../flex-box'
55
const FlexList = (props) => (
66
<FlexBox
77
as='ul'
8-
m={0}
9-
p={0}
108
flexDirection='column'
119
initialCSS={{ listStyle: 'none' }}
1210
{...props}

src/media-object/index.js

+3-13
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,15 @@ import { FlexBox } from '../flex-box'
33
import { Box } from '../box'
44

55
const MediaObject = (props) => (
6-
<FlexBox
7-
alignItems='flex-start'
8-
{...props}
9-
/>
6+
<FlexBox {...props} />
107
)
118

129
const MediaObjectSide = (props) => (
13-
<Box
14-
flex='0 0 auto'
15-
{...props}
16-
/>
10+
<Box flex='0 0 auto' {...props} />
1711
)
1812

1913
const MediaObjectContent = (props) => (
20-
<Box
21-
flex='1 1 auto'
22-
minWidth={0}
23-
{...props}
24-
/>
14+
<Box flex='1 1 auto' {...props} />
2515
)
2616

2717
Object.assign(MediaObject, {

src/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import isPropValid from '@emotion/is-prop-valid'
44
import { createBaseFactory } from 'react-styled-base'
55

66
export const createBase = createBaseFactory({ filter: isPropValid })
7-
export const blacklistOf = (styles) => Object.keys(styles.propTypes || {})
7+
export const blacklistOf = (styles) => Object.keys(Object(styles.propTypes))
88

99
export const getDisplayName = (comp, fallback = 'Component') =>
1010
(isStr(comp) ? comp : (comp.displayName || comp.name || fallback))

0 commit comments

Comments
 (0)