-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move code from toast to flash file (#149)
* feat: move code from toast to flash file * feat: add earthly package to flake.nix * feat: implement flash component into html * fix: change atom to success on put_flash * feat: update phoenix_live_view --------- Co-authored-by: Zoey de Souza Pessanha <[email protected]>
- Loading branch information
1 parent
e544d17
commit 878c610
Showing
13 changed files
with
179 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
.flash-component { | ||
display: inline-flex; | ||
flex-direction: column-reverse; | ||
position: fixed; | ||
max-width: 25rem; | ||
top: 1.5rem; | ||
right: 1.5rem; | ||
padding: 0.75rem; | ||
align-items: flex-start; | ||
gap: 0.75rem; | ||
border-radius: 0.25rem; | ||
background-color: #fff; | ||
|
||
.flash { | ||
@apply flex items-center; | ||
gap: 0.75rem; | ||
|
||
|
||
.flash-icon { | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
} | ||
|
||
p { | ||
@apply text-black-80; | ||
} | ||
} | ||
} | ||
|
||
.flash-component.success { | ||
@apply border-2 border-solid border-green-40; | ||
|
||
.flash-icon { | ||
@apply text-green-100; | ||
} | ||
} | ||
|
||
.flash-component.warning { | ||
@apply border-2 border-solid border-yellow-40; | ||
|
||
.flash-icon { | ||
@apply text-yellow-100; | ||
} | ||
} | ||
|
||
.flash-component.error { | ||
@apply border-2 border-solid border-red-40; | ||
|
||
.flash-icon { | ||
@apply text-red-100; | ||
} | ||
} | ||
|
||
.flash-component.show { | ||
opacity: 1; | ||
transform: translateY(0); | ||
transition: opacity 200ms ease-in-out, transform 200ms ease-in-out; | ||
} | ||
|
||
#flash-group { | ||
display: flex; | ||
flex-direction: column; | ||
position: fixed; | ||
align-items: flex-end; | ||
top: 1.5rem; | ||
right: 1.5rem; | ||
gap: 0.5rem; | ||
|
||
.flash-component { | ||
position: relative; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
name = "pescarte"; | ||
packages = with pkgs; | ||
[ | ||
earthly | ||
gnumake | ||
gcc | ||
openssl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
defmodule PescarteWeb.Flash do | ||
use PescarteWeb, :live_view | ||
|
||
def on_mount(:flash, _params, _session, socket) do | ||
Process.send_after(self(), :hide_flash, 10_000) | ||
socket = attach_hook(socket, :hide_flash, :handle_info, &hide_flash/2) | ||
|
||
{:cont, socket} | ||
end | ||
|
||
defp hide_flash(:hide_flash, socket) do | ||
{:halt, clear_flash(socket)} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.