Accepting color in Hairline component
This commit is contained in:
parent
53b169bc42
commit
369045b75f
|
@ -3,19 +3,20 @@ import * as React from 'react'
|
||||||
import { type Size, getSize } from '~/theme/size'
|
import { type Size, getSize } from '~/theme/size'
|
||||||
import { border } from '~/theme/variables'
|
import { border } from '~/theme/variables'
|
||||||
|
|
||||||
const calculateStyleFrom = (margin?: Size) => ({
|
const calculateStyleFrom = (color?: string, margin?: Size) => ({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '1px',
|
height: '1px',
|
||||||
backgroundColor: border,
|
backgroundColor: color || border,
|
||||||
margin: `${getSize(margin)} 0px`,
|
margin: `${getSize(margin)} 0px`,
|
||||||
})
|
})
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
margin?: Size,
|
margin?: Size,
|
||||||
|
color?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
const Hairline = ({ margin }: Props) => {
|
const Hairline = ({ margin, color }: Props) => {
|
||||||
const style = calculateStyleFrom(margin)
|
const style = calculateStyleFrom(color, margin)
|
||||||
|
|
||||||
return <div style={style} />
|
return <div style={style} />
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue