Skip to content

Commit

Permalink
fix: Parts.{Wizard, Sidebar} fixes (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
phgrey authored Oct 30, 2023
1 parent 75ea9f1 commit 08c4e6f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 41 deletions.
36 changes: 18 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
version: 2.1
aliases:

references:
images:
elixir: &ELIXIR_IMAGE heathmont/elixir-ci:1.13.1-otp-24-alpine
elixir_image: &elixir_image
image: heathmont/elixir-ci:1.13.1-otp-24-alpine
auth:
username: $DOCKER_USER
password: $DOCKER_PASS

jobs:
prelease:
docker:
- image: *ELIXIR_IMAGE
docker:
- *elixir_image
environment:
MIX_ENV: prod
steps:
Expand Down Expand Up @@ -53,8 +54,8 @@ jobs:
- _build

test:
docker:
- image: *ELIXIR_IMAGE
docker:
- *elixir_image
environment:
MIX_ENV: test
steps:
Expand Down Expand Up @@ -87,8 +88,8 @@ jobs:
- run:
command: mix test
dockerhub:
docker:
- image: *ELIXIR_IMAGE
docker:
- *elixir_image
steps:
- checkout
- setup_remote_docker:
Expand All @@ -99,20 +100,19 @@ jobs:
keys:
- v10-prod-{{ .Revision }}
- v10-prod-
- run: echo -e "$DOCKER_PASS" | docker login -u $DOCKER_USER --password-stdin
- run:
name: Docker login
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: scripts/deploy/docker-build-ci push $CIRCLE_TAG
deploy:
docker:
- image: *ELIXIR_IMAGE
docker:
- *elixir_image
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- attach_workspace:
at: ./
- run:
name: Docker login
command: echo -e "$DOCKER_PASS" | docker login -u $DOCKER_USER --password-stdin
- run:
name: Setup robot SSH key
command: |
Expand All @@ -125,8 +125,8 @@ jobs:
name: Deploy
command: scripts/deploy/stacks-deploy $CIRCLE_TAG
semrelease:
docker:
- image: *ELIXIR_IMAGE
docker:
- *elixir_image
environment:
MIX_ENV: test
resource_class: xlarge
Expand Down
21 changes: 13 additions & 8 deletions lib/moon/parts/sidebar/menu_link.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ defmodule Moon.Parts.Sidebar.MenuLink do
prop(class, :css_class)
@doc "Route to redirect to"
prop(route, :any)
@doc "Additional attributes set for the tag a"
prop(attrs, :map, default: %{})
@doc "Active page"
prop(active_page, :string, from_context: :active_page)

@doc "Default slot"
slot(default)
@doc "Active page"
data(active_page, :string, from_context: :active_page)

def render(assigns) do
~F"""
Expand All @@ -31,12 +34,14 @@ defmodule Moon.Parts.Sidebar.MenuLink do
],
@class
])}
attrs={
"data-phx-link": "redirect",
"data-phx-link-state": "push",
route: @route,
fake: "hello"
}
attrs={Map.merge(
%{
"data-phx-link": "redirect",
"data-phx-link-state": "push",
route: @route
},
@attrs
)}
is_active={@active_page == @route}
href={@route}
{=@id}
Expand Down
15 changes: 10 additions & 5 deletions lib/moon/parts/sidebar/slim_menu_link.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ defmodule Moon.Parts.Sidebar.SlimMenuLink do
prop(route, :any)
@doc "Icon name"
prop(icon_name, :any)
@doc "Additional attributes set for the tag a"
prop(attrs, :map, default: %{})
@doc "Active page"
data(active_page, :string, from_context: :active_page)
prop(active_page, :string, from_context: :active_page)

def render(assigns) do
~F"""
Expand All @@ -41,10 +43,13 @@ defmodule Moon.Parts.Sidebar.SlimMenuLink do
],
@class
])}
attrs={
"data-phx-link": "redirect",
"data-phx-link-state": "push"
}
attrs={Map.merge(
%{
"data-phx-link": "redirect",
"data-phx-link-state": "push"
},
@attrs
)}
is_active={@active_page == @route}
href={@route}
>
Expand Down
4 changes: 2 additions & 2 deletions lib/moon/parts/wizzard/step.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ defmodule Moon.Parts.Wizard.Step do
type="button"
{=@tabindex}
aria-selected={"#{@is_selected}"}
disabled={@disabled || @tabindex > @selected + 1}
:on-click={!(@disabled || @tabindex > @selected + 1) && @on_change}
disabled={@disabled || @tabindex > @selected}
:on-click={!(@disabled || @tabindex > @selected) && @on_change}
value={@tabindex}
>
<div
Expand Down
5 changes: 2 additions & 3 deletions lib/moon_web/examples/parts/modal_example/wizard.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ defmodule MoonWeb.Examples.Parts.ModalExample.Wizard do
import MoonWeb.Helpers.Lorem

data(selected, :integer, default: 0)
data(done, :boolean, default: false)

data(steps, :list,
default: [
Expand Down Expand Up @@ -60,12 +59,12 @@ defmodule MoonWeb.Examples.Parts.ModalExample.Wizard do
end

def handle_event("set_open", _, socket) do
Moon.Design.Modal.open("modal_wizard")
Modal.open("modal_wizard")
{:noreply, socket}
end

def handle_event("set_close", _, socket) do
Moon.Design.Modal.close("modal_wizard")
Modal.close("modal_wizard")
{:noreply, socket}
end

Expand Down
10 changes: 5 additions & 5 deletions lib/moon_web/examples/parts/sidebar_example/generic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ defmodule MoonWeb.Examples.Parts.SidebarExample.Generic do
def render(assigns) do
~F"""
<div>
<Sidebar.BottomNavigation
src="/moon_icons/svgs/logos/logo-moon-design-short.svg#item"
href="#"
on_click="open_sidebar"
/>
<Sidebar id="generic_sidebar">
<Sidebar.BottomNavigation
src="/moon_icons/svgs/logos/logo-moon-design-short.svg#item"
href="#"
on_click="open_sidebar"
/>
<Sidebar.Generic>
<Sidebar.Logo src="/moon/assets/svgs/moon_web/large_logo.svg#item" />
<Sidebar.Section>
Expand Down

0 comments on commit 08c4e6f

Please sign in to comment.