View Source PhoenixStorybook.BackendBehaviour behaviour (phoenix_storybook v0.7.2)

Behaviour implemented by your backend module.

Summary

Callbacks

Returns a configuration value from your config.exs storybook settings.

Returns a precompiled tree of your storybook stories.

Returns an entry from its absolute storybook path (not filesystem).

Returns all the nodes (stoires & folders) of the storybook content tree as a flat list.

Returns all the leaves (only stories) of the storybook content tree.

Retuns a storybook path from a story module.

Callbacks

config key, default

@callback config(key :: atom(), default :: any()) :: any()

Returns a configuration value from your config.exs storybook settings.

key is the config key default is an optional default value if no value can be fetched.

content_tree()

@callback content_tree() :: [
  %PhoenixStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhoenixStorybook.StoryEntry{icon: term(), name: term(), path: term()}
]

Returns a precompiled tree of your storybook stories.

find_entry_by_path(t)

@callback find_entry_by_path(String.t()) ::
  %PhoenixStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhoenixStorybook.StoryEntry{icon: term(), name: term(), path: term()}

Returns an entry from its absolute storybook path (not filesystem).

flat_list()

@callback flat_list() :: [
  %PhoenixStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhoenixStorybook.StoryEntry{icon: term(), name: term(), path: term()}
]

Returns all the nodes (stoires & folders) of the storybook content tree as a flat list.

leaves()

@callback leaves() :: [
  %PhoenixStorybook.StoryEntry{icon: term(), name: term(), path: term()}
]

Returns all the leaves (only stories) of the storybook content tree.

storybook_path(atom)

@callback storybook_path(atom()) :: String.t()

Retuns a storybook path from a story module.