Documentation ¶
Index ¶
- func NewHandler(name string, f interface{}, args ...Arg) http.Handler
- type Arg
- type Conf
- type IntArgConf
- type SortedMap
- type Story
- type StoryParameters
- type Storybook
- func (sh *Storybook) AddComponent(name string, componentConstructor interface{}, args ...Arg)
- func (sh *Storybook) Build(ctx context.Context) (err error)
- func (sh *Storybook) ListenAndServeWithContext(ctx context.Context) (err error)
- func (sh *Storybook) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type StorybookConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Arg ¶
type Arg struct { Name string Value interface{} Control interface{} Get func(q url.Values) interface{} }
Controls for the configuration. See https://storybook.js.org/docs/react/essentials/controls
func BooleanArg ¶
type Conf ¶
type Conf struct { Title string `json:"title"` Parameters StoryParameters `json:"parameters"` Args *SortedMap `json:"args"` ArgTypes *SortedMap `json:"argTypes"` Stories []Story `json:"stories"` }
type IntArgConf ¶
type IntArgConf struct{ Min, Max, Step *int }
type SortedMap ¶
type SortedMap struct {
// contains filtered or unexported fields
}
func NewSortedMap ¶
func NewSortedMap() *SortedMap
func (*SortedMap) MarshalJSON ¶
type StoryParameters ¶
type StoryParameters struct {
Server map[string]interface{} `json:"server"`
}
type Storybook ¶
type Storybook struct { // Path to the storybook-server directory, defaults to ./storybook-server. Path string // RoutePrefix is the prefix of HTTP routes, e.g. /prod/ RoutePrefix string // Config of the Stories. Config map[string]*Conf // Handlers for each of the components. Handlers map[string]http.Handler // Handler used to serve Storybook, defaults to filesystem at ./storybook-server/storybook-static. StaticHandler http.Handler Header string Server http.Server Log *zap.Logger }
func New ¶
func New(conf ...StorybookConfig) *Storybook
func (*Storybook) AddComponent ¶
func (*Storybook) ListenAndServeWithContext ¶
type StorybookConfig ¶
type StorybookConfig func(*Storybook)
func WithHeader ¶ added in v0.2.184
func WithHeader(header string) StorybookConfig
func WithServerAddr ¶
func WithServerAddr(addr string) StorybookConfig
Click to show internal directories.
Click to hide internal directories.