-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
166 additions
and
8 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
fullstack/lib/fullstack_web/components/custom_components.ex
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,21 @@ | ||
defmodule FullstackWeb.CustomComponents do | ||
use FullstackWeb, :html | ||
|
||
attr :btn_type, :string, values: ["warning", "error"], default: "warning" | ||
attr :rest, :global | ||
|
||
def custom_button(assigns) do | ||
~H""" | ||
<button | ||
class={[ | ||
"inline-flex items-center text-white justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 text-primary-foreground hover:bg-primary/90 h-10 mx-2 px-4 py-2 w-full sm:w-auto", | ||
@btn_type == "warning" && "bg-orange-500", | ||
@btn_type == "error" && "hover:ring-red-900 bg-red-700 hover:bg-red-600" | ||
]} | ||
{@rest} | ||
> | ||
<%= render_slot(@inner_block) %> | ||
</button> | ||
""" | ||
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.