Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: edit program mobile styles #253

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 28 additions & 27 deletions lib/bike_brigade_web/components/live_location.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ defmodule BikeBrigadeWeb.Components.LiveLocation do
location = %Location{}
changeset = Location.changeset(location)

{location, changeset
}
{location, changeset}
end

form = Phoenix.HTML.FormData.to_form(changeset, as: as)
Expand Down Expand Up @@ -173,8 +172,8 @@ defmodule BikeBrigadeWeb.Components.LiveLocation do
</button>
</div>
<div class={"#{if !@open, do: "hidden"} my-1 edit-mode"}>
<div class="flex space-x-1">
<div class="w-1/2">
<div class="flex flex-col md:flex-row items-baseline space-x-1">
<div class="w-full md:w-1/2">
<label class="block text-xs font-medium leading-5 text-gray-700">
Address
</label>
Expand All @@ -188,30 +187,32 @@ defmodule BikeBrigadeWeb.Components.LiveLocation do
</div>
<%= error_tag(@form, :address, show_field: false) %>
</div>
<div class="w-1/4">
<label class="block text-xs font-medium leading-5 text-gray-700">
Unit
</label>
<div class="mt-1 rounded-md shadow-sm">
<%= text_input(@form, :unit,
phx_change: "change",
phx_target: @myself,
class:
"block w-full px-3 py-2 placeholder-gray-400 transition duration-150 ease-in-out border border-gray-300 rounded-md appearance-none focus:outline-none focus:ring-blue focus:border-blue-300 sm:text-sm sm:leading-5"
) %>
<div class="flex w-full md:w-1/2 items-baseline">
<div class="w-1/2 mr-1">
<label class="block text-xs font-medium leading-5 text-gray-700">
Unit
</label>
<div class="mt-1 rounded-md shadow-sm">
<%= text_input(@form, :unit,
phx_change: "change",
phx_target: @myself,
class:
"block w-full px-3 py-2 placeholder-gray-400 transition duration-150 ease-in-out border border-gray-300 rounded-md appearance-none focus:outline-none focus:ring-blue focus:border-blue-300 sm:text-sm sm:leading-5"
) %>
</div>
</div>
</div>
<div class="w-1/4">
<label class="block text-xs font-medium leading-5 text-gray-700">
Buzzer
</label>
<div class="mt-1 rounded-md shadow-sm">
<%= text_input(@form, :buzzer,
phx_change: "change",
phx_target: @myself,
class:
"block w-full px-3 py-2 placeholder-gray-400 transition duration-150 ease-in-out border border-gray-300 rounded-md appearance-none focus:outline-none focus:ring-blue focus:border-blue-300 sm:text-sm sm:leading-5"
) %>
<div class="mt-2 w-1/2">
<label class="block text-xs font-medium leading-5 text-gray-700">
Buzzer
</label>
<div class="mt-1 rounded-md shadow-sm">
<%= text_input(@form, :buzzer,
phx_change: "change",
phx_target: @myself,
class:
"block w-full px-3 py-2 placeholder-gray-400 transition duration-150 ease-in-out border border-gray-300 rounded-md appearance-none focus:outline-none focus:ring-blue focus:border-blue-300 sm:text-sm sm:leading-5"
) %>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/bike_brigade_web/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ defmodule BikeBrigadeWeb.CoreComponents do
phx-window-keydown={hide_modal(@on_cancel, @id)}
phx-key="escape"
phx-click-away={hide_modal(@on_cancel, @id)}
class="relative hidden transition bg-white shadow-lg rounded-2xl p-14 shadow-zinc-700/10 ring-1 ring-zinc-700/10"
class="relative hidden transition bg-white shadow-lg rounded-2xl p-6 md:p-14 shadow-zinc-700/10 ring-1 ring-zinc-700/10"
>
<div class="absolute top-6 right-5">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
phx-change="validate"
phx-submit="save"
>
<div class="flex space-x-2">
<div class="flex flex-col space-x-0 space-y-2 md:space-y-0 md:space-x-2 md:flex-row">
<.input type="date" field={{f, :delivery_date}} label="Delivery Date" />
<.input type="time" field={{f, :start_time}} label="Start" />
<.input type="time" field={{f, :end_time}} label="End" />
Expand Down
10 changes: 6 additions & 4 deletions lib/bike_brigade_web/live/program_live/form_component.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
</:actions>
</.header>

<div :for={{s, i} <- Enum.with_index(inputs_for(c, :schedules))} class="flex space-x-2">
<div :for={{s, i} <- Enum.with_index(inputs_for(c, :schedules))} class="flex flex-col space-x-0 space-y-2 md:flex-row md:items-center md:space-y-1 md:space-x-2">
<.input
type="select"
class="mt-8"
field={{s, :weekday}}
options={[
Monday: :monday,
Expand All @@ -52,17 +53,18 @@
/>
<.input type="time" field={{s, :start_time}} />
<.input type="time" field={{s, :end_time}} />
<div class="justify-center ml-auto">
<div class="justify-center mt-1 ml-auto">
<.button
color={:clear}
size={:xxsmall}
size={:xsmall}
phx-click={JS.push("remove_schedule", value: %{index: i}, target: @myself)}
type="button"
>
<span class="sr-only">Close</span>
<span class="md:hidden mr-2 text-gray-700">Remove Schedule</span>
<Heroicons.x_mark solid class="w-6 h-6" />
</.button>
</div>
<hr class="mb-2 md:hidden"/>
</div>
</div>

Expand Down