Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
add setting navigation for section part, based on #4 , #44
Browse files Browse the repository at this point in the history
  • Loading branch information
shahryarjb committed Mar 6, 2023
1 parent 511fc80 commit b422d7b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/mishka_template_creator/components/blocks/settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ defmodule MishkaTemplateCreator.Components.Blocks.Settings do

attr :selected_setting, :map, required: true

@spec get_form(map) :: Phoenix.LiveView.Rendered.t()
def get_form(assigns) do
~H"""
<.simple_form
Expand Down
5 changes: 3 additions & 2 deletions lib/mishka_template_creator/components/elements/layout.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ defmodule MishkaTemplateCreator.Components.Elements.Layout do
}

attr :id, :string, required: true
attr :selected_block, :string, required: true
attr :selected_setting, :string, required: true
attr :selected_block, :map, required: true
attr :selected_setting, :map, required: true
attr :tag, :string, default: nil
attr :submit, :boolean, default: false
attr :on_delete, JS, default: %JS{}
Expand Down Expand Up @@ -49,6 +49,7 @@ defmodule MishkaTemplateCreator.Components.Elements.Layout do
parent_id={@id}
submit={@submit}
tag={Map.get(child, :tag)}
selected_setting={@selected_setting}
/>
</div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion lib/mishka_template_creator/components/elements/section.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule MishkaTemplateCreator.Components.Elements.Section do
attr :id, :string, required: true
attr :parent_id, :string, required: true
attr :selected_block, :string, required: true
attr :selected_setting, :map, required: true
attr :tag, :string, default: nil
attr :submit, :boolean, default: false
attr :on_delete, JS, default: %JS{}
Expand All @@ -34,6 +35,7 @@ defmodule MishkaTemplateCreator.Components.Elements.Section do
section_id={@id}
parent_id={@parent_id}
submit={@submit}
selected_setting={@selected_setting}
/>
<div :if={@tag} class="section-tag">
Expand All @@ -49,12 +51,18 @@ defmodule MishkaTemplateCreator.Components.Elements.Section do
attr :section_id, :string, required: true
attr :parent_id, :string, required: true
attr :submit, :boolean, default: false
attr :selected_setting, :map, required: true

@spec section_header(map) :: Phoenix.LiveView.Rendered.t()
defp section_header(assigns) do
~H"""
<div id={"section_header_#{@section_id}"} class="section-header">
<Settings.block_settings block_id={@section_id} custom_class="section-icons" />
<Settings.block_settings
block_id={@section_id}
custom_class="section-icons"
selected_setting={@selected_setting}
type="section"
/>
<Tag.block_tag
block_id={@section_id}
custom_class="section-icons"
Expand Down

0 comments on commit b422d7b

Please sign in to comment.