-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a button styled rounded and implement it within the hero component
- Loading branch information
Showing
5 changed files
with
123 additions
and
15 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
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,65 @@ | ||
{# | ||
/** | ||
* @file | ||
* Styled button rounded. | ||
* | ||
* @param 'primary' $theme | ||
* @param $icon_class | ||
*/ | ||
#} | ||
|
||
{% extends '@ui/atoms/Button/Button.twig' %} | ||
|
||
{% set icon_only = icon_only|default(false) %} | ||
|
||
{% set theme = theme|default('primary') %} | ||
|
||
{% set theme_shared = [ | ||
'rounded-full cursor-pointer transition', | ||
'disabled:cursor-not-allowed leading-6', | ||
{ | ||
'inline-block': icon is not defined, | ||
'inline-flex items-center': icon is defined, | ||
'px-6 py-4': not icon_only, | ||
'w-14 relative p-4': icon_only | ||
} | ||
] %} | ||
|
||
{% set theme_primary = ['text-white bg-black', 'hover:bg-opacity-75 disabled:bg-opacity-50'] %} | ||
|
||
{% set theme_secondary = [ | ||
'ring ring-inset ring-2 ring-black ring-opacity-25', | ||
{ | ||
'hover:ring-opacity-100': (attr is defined and attr.disabled is not defined) | ||
or attr is not defined | ||
} | ||
] %} | ||
|
||
{% set attr = | ||
merge_html_attributes( | ||
attr ?? null, | ||
null, | ||
{ | ||
class: [ | ||
theme_shared, | ||
theme == 'primary' ? theme_primary : '', | ||
theme == 'secondary' ? theme_secondary : '' | ||
] | ||
} | ||
) | ||
%} | ||
{% set icon_class = icon_class|default({}) %} | ||
{% if icon_only %} | ||
{% set icon_classes = | ||
icon_classes | ||
|default(['absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2']) | ||
|merge(icon_class) | ||
%} | ||
{% endif %} | ||
|
||
{% block icon %} | ||
{{ parent() }} | ||
{% if icon_only %} | ||
| ||
{% endif %} | ||
{% endblock %} |
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