1
Fork 0
mirror of https://github.com/Steffo99/bluelib.git synced 2024-12-22 19:44:21 +00:00

Add separators

This commit is contained in:
Steffo 2021-08-18 15:01:07 +02:00
parent c96e78dc93
commit d91295a5f1
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,37 @@
import * as React from "react"
import * as ReactDOM from "react-dom"
import * as Decorators from "../../utils/Decorators"
import { Separator } from "./Separator"
export default {
component: Separator,
title: "Separator/Separator",
decorators: [Decorators.Bluelib],
argTypes: {
customColor: {
control: {type: "color"},
},
},
}
export const Regular = props => (
<Separator {...props}/>
)
Regular.args = {
weight: "regular",
}
export const Heavy = Regular.bind({})
Heavy.args = {
weight: "heavy",
}
export const Light = Regular.bind({})
Light.args = {
weight: "light",
}

View file

@ -0,0 +1,29 @@
import * as React from "react"
import * as ReactDOM from "react-dom"
import * as Types from "../../types"
import {BaseElement} from "../BaseElement"
import mergeClassNames from "classnames"
interface SeparatorProps {
weight?: "light" | "regular" | "heavy",
[props: string]: any,
}
const WEIGHT_CLASSES = {
light: "separator-light",
regular: "",
heavy: "separator-heavy",
}
export function Separator({weight = "regular", ...props}: SeparatorProps): JSX.Element {
props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "separator", WEIGHT_CLASSES[weight])
return (
<BaseElement kind={"hr"} {...props}/>
)
}