Skip to content

Commit

Permalink
added icon function component
Browse files Browse the repository at this point in the history
into the generated component template
  • Loading branch information
matthieuchabert committed Sep 30, 2022
1 parent 4c34907 commit 7c159d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion assets/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
content: ["../lib/**/*.{ex,heex}", "./js/**/*.js"],
content: ["../lib/**/*.{ex,heex}", "./js/**/*.js", "../priv/templates/**/*.eex"],
safelist: [
{ pattern: /^lsb-(w|h|m|p)-.+/ },
{
Expand Down
18 changes: 8 additions & 10 deletions priv/templates/phx.gen.storybook/my_component.story.exs.eex
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ defmodule Storybook.Components.MyComponent do

# This is a dummy fonction that you should replace with your own component function:
# def function, do: &MyButton.my_button/1
def function, do: &my_component/1

def my_component(assigns) do
~H"<span><%=@text%></span>"
end
def function, do: &PhxLiveStorybook.Components.Icon.hero_icon/1

# A variation captures the rendered state of a UI component. Developers write multiple variations
# per component that describe all the “interesting” states a component can support.
Expand All @@ -20,20 +16,22 @@ defmodule Storybook.Components.MyComponent do
%Variation{
id: :default,
attributes: %{
text: "Hello World"
name: "calendar",
class: "lsb lsb-w-8 lsb-h-8"
}
},
%Variation{
id: :text_variation,
id: :icon_variation,
attributes: %{
text: "A text variation"
name: "bookmark",
class: "lsb lsb-w-8 lsb-h-8 lsb-text-red-500"
}
},
%VariationGroup{
id: :group,
variations: [
%Variation{id: :item_1, attributes: %{text: "item 1"}},
%Variation{id: :item_2, attributes: %{text: "item 2"}},
%Variation{id: :item_1, attributes: %{name: "cake", class: "lsb lsb-w-8 lsb-h-8"}},
%Variation{id: :item_2, attributes: %{name: "cake", class: "lsb lsb-w-16 lsb-h-16"}},
]
}
]
Expand Down

0 comments on commit 7c159d4

Please sign in to comment.