@@ -388,32 +388,64 @@ defmodule ExplorerWeb.CoreComponents do
388388 end
389389
390390 @ doc """
391- Renders a dynamic badge compoent .
391+ Renders a badge component .
392392 """
393393 attr :class , :string , default: nil
394- attr :status , :boolean , default: true
395- attr :falsy_text , :string , default: "Pending"
396- attr :truthy_text , :string , default: "Verified"
394+ attr :variant , :string , default: "accent"
397395 slot :inner_block , default: nil
398396
399- def dynamic_badge ( assigns ) do
397+ def badge ( assigns ) do
400398 ~H"""
401399 < span class = {
402400 classes ( [
403- "px-3 py-1 rounded-full" ,
404- case @ status do
405- true -> "text-accent-foreground bg-accent group-hover:bg-primary/80"
406- false -> "text-background bg-foreground group-hover:bg-foreground/80"
401+ "px-3 py-1 rounded-full font-semibold" ,
402+ case @ variant do
403+ "accent" -> "text-accent-foreground bg-accent group-hover:bg-accent/80"
404+ "primary" -> "text-primary-foreground bg-primary group-hover:bg-primary/80"
405+ "secondary" -> "text-secondary-foreground bg-secondary group-hover:bg-secondary/80"
406+ "destructive" -> "text-destructive-foreground bg-destructive group-hover:bg-destructive/80"
407+ "foreground" -> "text-background bg-foreground group-hover:bg-foreground/80"
408+ "card" -> "text-card-foreground bg-card group-hover:bg-card/80"
409+ _ -> "text-accent-foreground bg-accent group-hover:bg-accent/80"
407410 end ,
408411 @ class
409412 ] )
410413 } >
414+ <%= render_slot ( @ inner_block ) %>
415+ </ span >
416+ """
417+ end
418+
419+ @ doc """
420+ Renders a dynamic badge compoent.
421+ """
422+ attr :class , :string , default: nil
423+ attr :status , :boolean , default: true
424+ attr :falsy_text , :string , default: "Pending"
425+ attr :truthy_text , :string , default: "Verified"
426+ slot :inner_block , default: nil
427+
428+ def dynamic_badge ( assigns ) do
429+ ~H"""
430+ < . badge
431+ variant = {
432+ case @ status do
433+ true -> "accent"
434+ false -> "foreground"
435+ end
436+ }
437+ class = {
438+ classes ( [
439+ @ class
440+ ] )
441+ }
442+ >
411443 <%= case @status do
412444 true - > @truthy_text
413445 false - > @falsy_text
414446 end %>
415447 <%= render_slot ( @ inner_block ) %>
416- </ span >
448+ </ . badge >
417449 """
418450 end
419451
@@ -708,6 +740,43 @@ defmodule ExplorerWeb.CoreComponents do
708740 """
709741 end
710742
743+ @ doc """
744+ Renders an empty card background.
745+
746+ ## Examples
747+
748+ <.empty_card_background text="No users found" />
749+
750+ """
751+ attr :class , :string , default: nil
752+ attr :inner_text_class , :string , default: nil
753+ attr :text , :string , default: nil
754+ slot :inner_block
755+
756+ def empty_card_background ( assigns ) do
757+ ~H"""
758+ < . card_background class = {
759+ classes ( [
760+ "overflow-x-auto min-h-[38.45rem] flex flex-col items-center justify-center gap-2" ,
761+ @ class
762+ ] )
763+ } >
764+ < p
765+ :if = { @ text != nil }
766+ class = {
767+ classes ( [
768+ "text-lg text-muted-foreground" ,
769+ @ inner_text_class
770+ ] )
771+ }
772+ >
773+ <%= @ text %>
774+ </ p >
775+ <%= render_slot ( @ inner_block ) %>
776+ </ . card_background >
777+ """
778+ end
779+
711780 @ doc """
712781 Renders a data list.
713782
@@ -735,30 +804,6 @@ defmodule ExplorerWeb.CoreComponents do
735804 """
736805 end
737806
738- @ doc """
739- Renders a back navigation link.
740-
741- ## Examples
742-
743- <.back navigate={~p"/posts"}>Back to posts</.back>
744- """
745- attr :navigate , :any , required: true
746- slot :inner_block , required: true
747-
748- def back ( assigns ) do
749- ~H"""
750- < div class = "mt-16 " >
751- < . link
752- navigate = { @ navigate }
753- class = "text-sm font-semibold leading-6 text-zinc-900 hover:text-zinc-700 "
754- >
755- < . icon name = "hero-arrow-left-solid " class = "h-3 w-3 " />
756- <%= render_slot ( @ inner_block ) %>
757- </ . link >
758- </ div >
759- """
760- end
761-
762807 @ doc """
763808 Renders a [Heroicon](https://heroicons.com).
764809
0 commit comments