@@ -41,13 +41,13 @@ defmodule FrontmanServerWeb.CoreComponents do
4141 <.flash kind={:info} flash={@flash} />
4242 <.flash kind={:info} phx-mounted={show("#flash")}>Welcome Back!</.flash>
4343 """
44- attr :id , :string , doc: "the optional id of flash container"
45- attr :flash , :map , default: % { } , doc: "the map of flash messages to display"
46- attr :title , :string , default: nil
47- attr :kind , :atom , values: [ :info , :error ] , doc: "used for styling and flash lookup"
48- attr :rest , :global , doc: "the arbitrary HTML attributes to add to the flash container"
44+ attr ( :id , :string , doc: "the optional id of flash container" )
45+ attr ( :flash , :map , default: % { } , doc: "the map of flash messages to display" )
46+ attr ( :title , :string , default: nil )
47+ attr ( :kind , :atom , values: [ :info , :error ] , doc: "used for styling and flash lookup" )
48+ attr ( :rest , :global , doc: "the arbitrary HTML attributes to add to the flash container" )
4949
50- slot :inner_block , doc: "the optional inner block that renders the flash message"
50+ slot ( :inner_block , doc: "the optional inner block that renders the flash message" )
5151
5252 def flash ( assigns ) do
5353 assigns = assign_new ( assigns , :id , fn -> "flash-#{ assigns . kind } " end )
@@ -90,10 +90,10 @@ defmodule FrontmanServerWeb.CoreComponents do
9090 <.button phx-click="go" variant="primary">Send!</.button>
9191 <.button navigate={~p"/"}>Home</.button>
9292 """
93- attr :rest , :global , include: ~w( href navigate patch method download name value disabled)
94- attr :class , :string
95- attr :variant , :string , values: ~w( primary)
96- slot :inner_block , required: true
93+ attr ( :rest , :global , include: ~w( href navigate patch method download name value disabled) )
94+ attr ( :class , :string )
95+ attr ( :variant , :string , values: ~w( primary) )
96+ slot ( :inner_block , required: true )
9797
9898 def button ( % { rest: rest } = assigns ) do
9999 variants = % { "primary" => "btn-primary" , nil => "btn-primary btn-soft" }
@@ -144,30 +144,33 @@ defmodule FrontmanServerWeb.CoreComponents do
144144 <.input field={@form[:email]} type="email" />
145145 <.input name="my-input" errors={["oh no!"]} />
146146 """
147- attr :id , :any , default: nil
148- attr :name , :any
149- attr :label , :string , default: nil
150- attr :value , :any
147+ attr ( :id , :any , default: nil )
148+ attr ( :name , :any )
149+ attr ( :label , :string , default: nil )
150+ attr ( :value , :any )
151151
152- attr :type , :string ,
152+ attr ( :type , :string ,
153153 default: "text" ,
154154 values: ~w( checkbox color date datetime-local email file month number password
155155 search select tel text textarea time url week)
156+ )
156157
157- attr :field , Phoenix.HTML.FormField ,
158+ attr ( :field , Phoenix.HTML.FormField ,
158159 doc: "a form field struct retrieved from the form, for example: @form[:email]"
160+ )
159161
160- attr :errors , :list , default: [ ]
161- attr :checked , :boolean , doc: "the checked flag for checkbox inputs"
162- attr :prompt , :string , default: nil , doc: "the prompt for select inputs"
163- attr :options , :list , doc: "the options to pass to Phoenix.HTML.Form.options_for_select/2"
164- attr :multiple , :boolean , default: false , doc: "the multiple flag for select inputs"
165- attr :class , :string , default: nil , doc: "the input class to use over defaults"
166- attr :error_class , :string , default: nil , doc: "the input error class to use over defaults"
162+ attr ( :errors , :list , default: [ ] )
163+ attr ( :checked , :boolean , doc: "the checked flag for checkbox inputs" )
164+ attr ( :prompt , :string , default: nil , doc: "the prompt for select inputs" )
165+ attr ( :options , :list , doc: "the options to pass to Phoenix.HTML.Form.options_for_select/2" )
166+ attr ( :multiple , :boolean , default: false , doc: "the multiple flag for select inputs" )
167+ attr ( :class , :string , default: nil , doc: "the input class to use over defaults" )
168+ attr ( :error_class , :string , default: nil , doc: "the input error class to use over defaults" )
167169
168- attr :rest , :global ,
170+ attr ( :rest , :global ,
169171 include: ~w( accept autocomplete capture cols disabled form list max maxlength min minlength
170172 multiple pattern placeholder readonly required rows size step)
173+ )
171174
172175 def input ( % { field: % Phoenix.HTML.FormField { } = field } = assigns ) do
173176 errors = if Phoenix.Component . used_input? ( field ) , do: field . errors , else: [ ]
@@ -284,9 +287,9 @@ defmodule FrontmanServerWeb.CoreComponents do
284287 @ doc """
285288 Renders a header with title.
286289 """
287- slot :inner_block , required: true
288- slot :subtitle
289- slot :actions
290+ slot ( :inner_block , required: true )
291+ slot ( :subtitle )
292+ slot ( :actions )
290293
291294 def header ( assigns ) do
292295 ~H"""
@@ -314,20 +317,21 @@ defmodule FrontmanServerWeb.CoreComponents do
314317 <:col :let={user} label="username">{user.username}</:col>
315318 </.table>
316319 """
317- attr :id , :string , required: true
318- attr :rows , :list , required: true
319- attr :row_id , :any , default: nil , doc: "the function for generating the row id"
320- attr :row_click , :any , default: nil , doc: "the function for handling phx-click on each row"
320+ attr ( :id , :string , required: true )
321+ attr ( :rows , :list , required: true )
322+ attr ( :row_id , :any , default: nil , doc: "the function for generating the row id" )
323+ attr ( :row_click , :any , default: nil , doc: "the function for handling phx-click on each row" )
321324
322- attr :row_item , :any ,
325+ attr ( :row_item , :any ,
323326 default: & Function . identity / 1 ,
324327 doc: "the function for mapping each row before calling the :col and :action slots"
328+ )
325329
326330 slot :col , required: true do
327- attr :label , :string
331+ attr ( :label , :string )
328332 end
329333
330- slot :action , doc: "the slot for showing user actions in the last table column"
334+ slot ( :action , doc: "the slot for showing user actions in the last table column" )
331335
332336 def table ( assigns ) do
333337 assigns =
@@ -378,7 +382,7 @@ defmodule FrontmanServerWeb.CoreComponents do
378382 </.list>
379383 """
380384 slot :item , required: true do
381- attr :title , :string , required: true
385+ attr ( :title , :string , required: true )
382386 end
383387
384388 def list ( assigns ) do
@@ -412,8 +416,8 @@ defmodule FrontmanServerWeb.CoreComponents do
412416 <.icon name="hero-x-mark" />
413417 <.icon name="hero-arrow-path" class="ml-1 size-3 motion-safe:animate-spin" />
414418 """
415- attr :name , :string , required: true
416- attr :class , :string , default: "size-4"
419+ attr ( :name , :string , required: true )
420+ attr ( :class , :string , default: "size-4" )
417421
418422 def icon ( % { name: "hero-" <> _ } = assigns ) do
419423 ~H"""
@@ -475,35 +479,49 @@ defmodule FrontmanServerWeb.CoreComponents do
475479 @ doc """
476480 Renders a connected account row with connect/disconnect actions.
477481 """
478- attr :provider , :string , required: true
479- attr :label , :string , required: true
480- attr :identities , :list , required: true
482+ attr ( :provider , :string , required: true )
483+ attr ( :label , :string , required: true )
484+ attr ( :identities , :list , required: true )
481485
482- slot :inner_block , required: true , doc: "the icon slot"
486+ slot ( :inner_block , required: true , doc: "the icon slot" )
483487
484488 def connected_account ( assigns ) do
485489 identity = Enum . find ( assigns . identities , & ( & 1 . provider == assigns . provider ) )
486490 assigns = assign ( assigns , :identity , identity )
487491
488492 ~H"""
489- < div class = "flex items-center justify-between p- 4 border border-base-300 rounded-lg " >
493+ < div class = "flex items-center justify-between px-5 py- 4 border border-white/[0.08] bg-white/[0.02] rounded-lg " >
490494 < div class = "flex items-center gap-3 " >
491- { render_slot ( @ inner_block ) }
495+ < span class = " text-white/70 " > { render_slot ( @ inner_block ) } </ span >
492496 < div >
493- < p class = "font-medium " > { @ label } </ p >
494- < p :if = { @ identity } class = "text-sm text-base-content/70 " > { @ identity . provider_email } </ p >
495- < p :if = { ! @ identity } class = "text-sm text-base-content/70 " > Not connected</ p >
497+ < p class = "text-sm font-medium text-white/90 " > { @ label } </ p >
498+ < p :if = { @ identity } class = "text-xs text-white/50 " > { @ identity . provider_email } </ p >
499+ < p :if = { ! @ identity } class = "text-xs text-white/40 " > Not connected</ p >
496500 </ div >
497501 </ div >
498502 < . link
499503 :if = { @ identity }
500504 href = { ~p" /auth/#{ @ provider } /unlink" }
501505 method = "delete "
502- class = "btn btn-outline btn-sm "
506+ class = { [
507+ "rounded-lg border border-white/[0.12] bg-white/[0.04]" ,
508+ "px-3 py-1.5 text-xs font-medium text-white/70" ,
509+ "transition-all duration-150" ,
510+ "hover:bg-red-500/10 hover:border-red-500/30 hover:text-red-400"
511+ ] }
503512 >
504513 Disconnect
505514 </ . link >
506- < . link :if = { ! @ identity } href = { ~p" /auth/#{ @ provider } /link" } class = "btn btn-outline btn-sm " >
515+ < . link
516+ :if = { ! @ identity }
517+ href = { ~p" /auth/#{ @ provider } /link" }
518+ class = { [
519+ "rounded-lg border border-white/[0.12] bg-white/[0.04]" ,
520+ "px-3 py-1.5 text-xs font-medium text-white/70" ,
521+ "transition-all duration-150" ,
522+ "hover:bg-white/[0.08] hover:border-white/[0.18] hover:text-white"
523+ ] }
524+ >
507525 Connect
508526 </ . link >
509527 </ div >
0 commit comments