Skip to content

Commit

Permalink
improve disclosure button story
Browse files Browse the repository at this point in the history
  • Loading branch information
woylie committed Jul 28, 2024
1 parent 139b0a6 commit 0056195
Showing 1 changed file with 42 additions and 27 deletions.
69 changes: 42 additions & 27 deletions lib/doggo/storybook/disclosure_button.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ defmodule Doggo.Storybook.DisclosureButton do
@moduledoc false
alias PhoenixStorybook.Stories.Variation

def dependent_components, do: [:cluster]

def container, do: {:div, class: :container}

def variations(opts) do
Expand All @@ -14,13 +12,13 @@ defmodule Doggo.Storybook.DisclosureButton do
controls: "data-table-default"
},
slots: ["Learn More About Dog Breeds"],
template: table("data-table-default", opts)
template: variation_template("data-table-default", opts)
}
]
end

def modifier_variation_group_template(name, opts) do
table("data-table-#{name}", opts)
variation_group_template("data-table-#{name}", opts)
end

def modifier_variation_base(_id, name, value, _opts) do
Expand All @@ -30,35 +28,52 @@ defmodule Doggo.Storybook.DisclosureButton do
}
end

defp table(id, _opts) do
defp variation_template(id, _opts) do
"""
<div>
<div>
<.psb-variation-group/>
</div>
#{table(id)}
</div>
"""
end

defp variation_group_template(id, _opts) do
"""
<div>
<div style="display: flex; flex-wrap: wrap; gap: 8px; align-items: center">
<.psb-variation-group/>
</div>
<table id="#{id}" hidden>
<tr>
<th>Breed Name</th>
<th>Origin</th>
<th>Characteristic</th>
</tr>
<tr>
<td>Labrador Retriever</td>
<td>Canada</td>
<td>Friendly and outgoing</td>
</tr>
<tr>
<td>German Shepherd</td>
<td>Germany</td>
<td>Intelligent and versatile</td>
</tr>
<tr>
<td>Beagle</td>
<td>England</td>
<td>Curious and merry</td>
</tr>
</table>
#{table(id)}
</div>
"""
end

defp table(id) do
"""
<table id="#{id}" hidden>
<tr>
<th>Breed Name</th>
<th>Origin</th>
<th>Characteristic</th>
</tr>
<tr>
<td>Labrador Retriever</td>
<td>Canada</td>
<td>Friendly and outgoing</td>
</tr>
<tr>
<td>German Shepherd</td>
<td>Germany</td>
<td>Intelligent and versatile</td>
</tr>
<tr>
<td>Beagle</td>
<td>England</td>
<td>Curious and merry</td>
</tr>
</table>
"""
end
end

0 comments on commit 0056195

Please sign in to comment.