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 { border } from '~/theme/variables'
|
||||
|
||||
const calculateStyleFrom = (margin?: Size) => ({
|
||||
const calculateStyleFrom = (color?: string, margin?: Size) => ({
|
||||
width: '100%',
|
||||
height: '1px',
|
||||
backgroundColor: border,
|
||||
backgroundColor: color || border,
|
||||
margin: `${getSize(margin)} 0px`,
|
||||
})
|
||||
|
||||
type Props = {
|
||||
margin?: Size,
|
||||
color?: string,
|
||||
}
|
||||
|
||||
const Hairline = ({ margin }: Props) => {
|
||||
const style = calculateStyleFrom(margin)
|
||||
const Hairline = ({ margin, color }: Props) => {
|
||||
const style = calculateStyleFrom(color, margin)
|
||||
|
||||
return <div style={style} />
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue