mirror of
https://github.com/Steffo99/bluelib.git
synced 2024-12-22 19:44:21 +00:00
✨ Add chapters
This commit is contained in:
parent
bd9494ecf4
commit
977b7d3e77
2 changed files with 94 additions and 0 deletions
61
src/components/chapters/Chapter.stories.jsx
Normal file
61
src/components/chapters/Chapter.stories.jsx
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
import * as React from "react"
|
||||||
|
import * as ReactDOM from "react-dom"
|
||||||
|
import * as Decorators from "../../utils/Decorators"
|
||||||
|
import { Chapter } from "./Chapter"
|
||||||
|
import { Box } from "../panels/Box"
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
component: Chapter,
|
||||||
|
title: "Chapters/Chapter",
|
||||||
|
decorators: [Decorators.Bluelib],
|
||||||
|
argTypes: {
|
||||||
|
customColor: {
|
||||||
|
control: {type: "color"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const Default = props => (
|
||||||
|
<Chapter {...props}>
|
||||||
|
<Box>First</Box>
|
||||||
|
<Box>Second</Box>
|
||||||
|
<Box>Third</Box>
|
||||||
|
</Chapter>
|
||||||
|
)
|
||||||
|
Default.args = {}
|
||||||
|
|
||||||
|
|
||||||
|
export const AutoWrap = props => (
|
||||||
|
<Chapter {...props}>
|
||||||
|
<Box>First</Box>
|
||||||
|
<Box>Second</Box>
|
||||||
|
<Box>Third</Box>
|
||||||
|
<Box>Fourth</Box>
|
||||||
|
<Box>Fifth</Box>
|
||||||
|
<Box>Sixth</Box>
|
||||||
|
<Box>Seventh</Box>
|
||||||
|
<Box>Eighth</Box>
|
||||||
|
<Box>Ninth</Box>
|
||||||
|
<Box>Tenth</Box>
|
||||||
|
<Box>Eleventh</Box>
|
||||||
|
<Box>Twelfth</Box>
|
||||||
|
<Box>Thirtheenth</Box>
|
||||||
|
<Box>Fourtheenth</Box>
|
||||||
|
<Box>Fiftheenth</Box>
|
||||||
|
</Chapter>
|
||||||
|
)
|
||||||
|
AutoWrap.args = {}
|
||||||
|
|
||||||
|
|
||||||
|
export const ForceWrap = props => (
|
||||||
|
<Chapter {...props}>
|
||||||
|
<Box>First</Box>
|
||||||
|
<Box>Second</Box>
|
||||||
|
<Chapter.ForceWrap/>
|
||||||
|
<Box>Third</Box>
|
||||||
|
<Box>Fourth</Box>
|
||||||
|
</Chapter>
|
||||||
|
)
|
||||||
|
ForceWrap.args = {}
|
33
src/components/chapters/Chapter.tsx
Normal file
33
src/components/chapters/Chapter.tsx
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
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 ChapterProps {
|
||||||
|
[props: string]: any,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function Chapter({...props}: ChapterProps): JSX.Element {
|
||||||
|
props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "chapter")
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BaseElement kind={"section"} {...props}/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface ChapterForceWrapProps {
|
||||||
|
[props: string]: any,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Chapter.ForceWrap = function({...props}: ChapterForceWrapProps): JSX.Element {
|
||||||
|
props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "chapter-forcewrap")
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BaseElement kind={"div"} {...props}/>
|
||||||
|
)
|
||||||
|
}
|
Loading…
Reference in a new issue