Documentation
¶
Index ¶
- func NewHandler(name string, f any, 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 any, args ...Arg) *Conf
- 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 ¶
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 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 *slog.Logger
AdditionalPrefixJS string
}
func New ¶
func New(conf ...StorybookConfig) *Storybook
func (*Storybook) AddComponent ¶
func (*Storybook) ListenAndServeWithContext ¶
type StorybookConfig ¶
type StorybookConfig func(*Storybook)
func WithAdditionalPreviewJS ¶ added in v0.0.1057
func WithAdditionalPreviewJS(content string) StorybookConfig
WithAdditionalPreviewJS / WithAdditionalPreviewJS allows to add content to the generated .storybook/preview.js file. For example this can be used to include custom CSS.
func WithHeader ¶ added in v0.0.1057
func WithHeader(header string) StorybookConfig
func WithPath ¶ added in v0.0.1057
func WithPath(path string) StorybookConfig
func WithServerAddr ¶
func WithServerAddr(addr string) StorybookConfig
Click to show internal directories.
Click to hide internal directories.