项目作者: rnons

项目描述 :
A library to assemble examples or develop components separately.
高级语言: PureScript
项目地址: git://github.com/rnons/purescript-halogen-storybook.git
创建时间: 2018-01-18T13:47:16Z
项目社区:https://github.com/rnons/purescript-halogen-storybook

开源协议:BSD 3-Clause "New" or "Revised" License

下载


purescript-halogen-storybook


purescript-halogen-storybook on Pursuit

A library to assemble examples or develop components separately.

DEMO

You might be interested in purescript-halogen-custom-element which allows embedding Halogen components anywhere in an HTML or Markdown file.

How to use

First define the stories. Each story consists of a name and a component. If the name is empty string, it will be rendered as the index page.

  1. import Foreign.Object as Object
  2. import Halogen.Storybook (Stories, runStorybook, proxy)
  3. stories :: forall m. Stories m
  4. stories = Object.fromFoldable
  5. [ Tuple "" $ proxy ExpIndex.component -- override the index page
  6. , Tuple "count" $ proxy ExpCount.component
  7. , Tuple "input" $ proxy ExpInput.component
  8. ]

Then add a runStorybook line to your main function. That’s it.

  1. main = HA.runHalogenAff do
  2. HA.awaitBody >>=
  3. runStorybook
  4. { stories
  5. , logo: Nothing -- pass `Just HH.PlainHTML` to override the logo
  6. }

You need to include the CSS by yourself, use Storybook.css as an example.