defmodule Storybook.MyPage do # See https://hexdocs.pm/phoenix_storybook/PhoenixStorybook.Story.html for full story # documentation. use PhoenixStorybook.Story, :page def doc, do: "Your very first steps into using Phoenix Storybook" # Declare an optional tab-based navigation in your page: def navigation do [ {:welcome, "Welcome", {:fa, "hand-wave", :thin}}, {:components, "Components", {:fa, "toolbox", :thin}}, {:sandboxing, "Sandboxing", {:fa, "box-check", :thin}}, {:icons, "Icons", {:fa, "icons", :thin}} ] end # This is a dummy fonction that you should replace with your own HEEx content. def render(assigns = %{tab: :welcome}) do ~H"""

We generated your storybook with an example of a page and a component. Explore the generated *.story.exs files in your /storybook directory. When you're ready to add your own, just drop your new story & index files into the same directory and refresh your storybook.

Here are a few docs you might be interested in:

<.description_list items={[ {"Create a new Story", doc_link("Story")}, {"Display components using Variations", doc_link("Stories.Variation")}, {"Group components using VariationGroups", doc_link("Stories.VariationGroup")}, {"Organize the sidebar with Index files", doc_link("Index")} ]} />

This should be enough to get you started, but you can use the tabs in the upper-right corner of this page to check out advanced usage guides.

""" end def render(assigns = %{tab: guide}) when guide in ~w(components sandboxing icons)a do assigns = assign(assigns, guide: guide, guide_content: PhoenixStorybook.Guides.markup("#{guide}.md") ) ~H"""

This and other guides are also available on HexDocs.

<%= Phoenix.HTML.raw(@guide_content) %>
""" end defp description_list(assigns) do ~H"""
<%= for {dt, link} <- @items do %>
<%= dt %>
<%= link %>
<% end %>
""" end defp doc_link(page) do "https://hexdocs.pm/phoenix_storybook/PhoenixStorybook.#{page}.html" end end