@@ -29,7 +29,6 @@ defmodule <%= @web_namespace %>.CoreComponents do
29
29
"""
30
30
attr :id , :string , doc: "the optional id of flash container"
31
31
attr :flash , :map , default: % { } , doc: "the map of flash messages to display"
32
- attr :title , :string , default: nil
33
32
attr :kind , :atom , values: [ :info , :error ] , doc: "used for styling and flash lookup"
34
33
attr :rest , :global , doc: "the arbitrary HTML attributes to add to the flash container"
35
34
@@ -46,26 +45,26 @@ defmodule <%= @web_namespace %>.CoreComponents do
46
45
role = "alert "
47
46
class = { [
48
47
"fixed top-2 right-2 mr-2 w-80 sm:w-96 z-50 rounded-lg p-3 ring-1" ,
49
- @ kind == :info && "bg-emerald -50 text-emerald -800 ring-emerald -500 fill-cyan -900" ,
48
+ @ kind == :info && "bg-sky -50 text-sky -800 shadow-md ring-sky -500 fill-sky -900" ,
50
49
@ kind == :error && "bg-rose-50 text-rose-900 shadow-md ring-rose-500 fill-rose-900"
51
50
] }
52
51
{ @ rest }
53
52
>
54
- < p :if = { @ title } class = "flex items-center gap-1.5 text-sm font-semibold leading-6 " >
55
- < . icon :if = { @ kind == :info } name = "hero-information-circle-mini " class = "h-4 w-4 " />
56
- < . icon :if = { @ kind == :error } name = "hero-exclamation-circle-mini " class = "h-4 w-4 " />
57
- { @ title }
58
- </ p >
59
- < p class = "mt-2 text-sm leading-5 " > { msg } </ p >
60
- < button type = " button " class = "group absolute top-1 right-1 p-2 " aria-label = <%= maybe_heex_attr_gettext.( " close " , @gettext) % > >
61
- < . icon name = " hero-x-mark-solid " class = " h-5 w-5 opacity-40 group-hover:opacity-70 " / >
62
- </ button >
53
+ < div class = "flex gap-2 " >
54
+ < . icon :if = { @ kind == :info } name = "hero-information-circle-mini " class = "h-5 w-5 shrink-0 " />
55
+ < . icon :if = { @ kind == :error } name = "hero-exclamation-circle-mini " class = "h-5 w-5 shrink-0 " />
56
+ < p class = " text-sm leading-5 " > { msg } </ p >
57
+ < div class = " flex-1 " / >
58
+ < button type = " button " class = "group flex self-start " aria-label = <%= maybe_heex_attr_gettext.( " close " , @gettext) % > >
59
+ < . icon name = " hero-x-mark-solid " class = "h-5 w-5 opacity-40 group-hover:opacity-70 " / >
60
+ </ button >
61
+ </ div >
63
62
</ div >
64
63
"""
65
64
end
66
65
67
66
@ doc """
68
- Shows the flash group with standard titles and content.
67
+ Shows the flash group with standard content.
69
68
70
69
## Examples
71
70
@@ -77,12 +76,11 @@ defmodule <%= @web_namespace %>.CoreComponents do
77
76
def flash_group ( assigns ) do
78
77
~H"""
79
78
< div id = { @ id } aria-live = "polite " >
80
- < . flash kind = { :info } title = <%= maybe_heex_attr_gettext.( " Success! " , @gettext) % > flash={ @ flash } />
81
- < .flash kind = { :error } title= <%= maybe_heex_attr_gettext . ( "Error!" , @ gettext ) %> flash={ @ flash } />
79
+ < . flash kind = { :info } flash = { @ flash } />
80
+ < . flash kind = { :error } flash = { @ flash } />
82
81
< . flash
83
82
id = "client-error "
84
83
kind = { :error }
85
- title = <%= maybe_heex_attr_gettext.( "We can't find the internet " , @gettext) % >
86
84
phx-disconnected = { show ( ".phx-client-error #client-error" ) }
87
85
phx-connected = { hide ( "#client-error" ) }
88
86
hidden
@@ -94,7 +92,6 @@ defmodule <%= @web_namespace %>.CoreComponents do
94
92
< . flash
95
93
id = "server-error "
96
94
kind = { :error }
97
- title = <%= maybe_heex_attr_gettext.( "Something went wrong! ", @gettext) % >
98
95
phx-disconnected = { show ( ".phx-server-error #server-error" ) }
99
96
phx-connected = { hide ( "#server-error" ) }
100
97
hidden
0 commit comments