-
Notifications
You must be signed in to change notification settings - Fork 37
/
index.jsx
53 lines (47 loc) · 1.35 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from 'react'
import MuiDivider from '@material-ui/core/Divider'
import { withStyles } from '../../styles'
import { normalTheme } from '../theme'
import TextDivider from './TextDivider'
/**
* @desc If this component is provided a string children, it will render a `<TextDivider>` component
* and will handle the `textAlign` prop that accepts a `"center"` or undefined value
*/
const Divider = props =>
typeof props.children === 'string' ? (
<TextDivider {...props} />
) : (
<MuiDivider {...props} />
)
Divider.propTypes = {
...TextDivider.propTypes
}
export default Divider
const defaultValues = {
borderRadius: 6,
dialog: {
sm: {
padding: 16
},
md: {
padding: 32
}
}
}
export const DeprecatedDivider = withStyles({
/**
* calcs are made since we have defaultMargin on the Dialog so
* we need to remove the left margin and add the width of 2 margins
* in order to have the divider takes the full width of the Modal
*/
root: {
[normalTheme.breakpoints.down('md')]: {
width: `calc(100% + ${defaultValues.dialog.sm.padding}*2px)`,
marginLeft: `-${defaultValues.dialog.sm.padding}px`
},
[normalTheme.breakpoints.up('md')]: {
width: `calc(100% + ${defaultValues.dialog.md.padding}*2px)`,
marginLeft: `-${defaultValues.dialog.md.padding}px`
}
}
})(Divider)