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

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

@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.

@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.

@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).

@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.

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

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

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

Retuns a storybook path from a story module.