This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add layout directory to separate components, based on #74
- Loading branch information
1 parent
bf8e366
commit 4eef26e
Showing
12 changed files
with
153 additions
and
129 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...mplate_creator/components/blocks/aside.ex → ...mplate_creator/components/Layout/aside.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...late_creator/components/blocks/content.ex → ...late_creator/components/Layout/content.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...late_creator/components/blocks/history.ex → ...late_creator/components/Layout/history.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
defmodule MishkaTemplateCreator.Components.Blocks.Icon do | ||
use Phoenix.Component | ||
alias MishkaTemplateCreator.Data.TailwindSetting | ||
|
||
attr(:module, :string, required: true) | ||
attr(:class, :string, required: false, default: "w-6 h-6 mx-auto stroke-current") | ||
|
||
def dynamic(assigns) do | ||
~H""" | ||
<%= Phoenix.LiveView.TagEngine.component( | ||
Code.eval_string("&(#{@module}/1)") |> elem(0), | ||
[class: @class], | ||
{__ENV__.module, __ENV__.function, __ENV__.file, __ENV__.line} | ||
) %> | ||
""" | ||
end | ||
|
||
attr(:myself, :integer, required: true) | ||
attr(:selected, :string, required: false, default: nil) | ||
attr(:block_id, :string, required: false, default: nil) | ||
|
||
attr(:class, :string, | ||
required: false, | ||
default: "w-4 h-4 mx-auto stroke-current text-black cursor-pointer" | ||
) | ||
|
||
def select(assigns) do | ||
assigns = assign(assigns, icons: TailwindSetting.hero_icons()) | ||
|
||
~H""" | ||
<div class="flex flex-wrap w-full gap-1 border border-gray-300 p-3 rounded-md mb-3 justify-start"> | ||
<span | ||
:for={icon <- @icons} | ||
phx-click="select_icon" | ||
phx-value-name={icon} | ||
phx-value-block-id={@block_id} | ||
phx-target={@myself} | ||
> | ||
<.dynamic | ||
module={"Heroicons.#{icon}"} | ||
class={@class <> "#{if @selected == icon, do: " !text-red-600", else: ""}"} | ||
/> | ||
</span> | ||
</div> | ||
""" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters