-
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.
Feat(web-twig): Add Message and Link for ToastBar #DS-1213
- Loading branch information
Showing
18 changed files
with
269 additions
and
77 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
24 changes: 24 additions & 0 deletions
24
packages/web-twig/src/Resources/components/Toast/ToastBarLink.twig
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,24 @@ | ||
{# API #} | ||
{%- set props = props | default([]) -%} | ||
{%- set _color = props.color | default('inverted') -%} | ||
{%- set _isUnderlined = props.isUnderlined ?? true -%} | ||
{%- set _children = block('content') -%} | ||
|
||
{# Class names #} | ||
{%- set _rootClassName = _spiritClassPrefix ~ 'ToastBar__link' -%} | ||
|
||
{# Miscellaneous #} | ||
{%- set _styleProps = useStyleProps(props) -%} | ||
{%- set _allowedAttributes = [ 'target', 'title' ] -%} | ||
{%- set _classNames = [ _rootClassName, _styleProps.className ] -%} | ||
|
||
{% embed "@spirit/link.twig" with { props: props | merge({ | ||
color: _color, | ||
isUnderlined: _isUnderlined, | ||
'data-spirit-populate-field': 'link', | ||
UNSAFE_className: _classNames | join(' '), | ||
UNSAFE_style: _styleProps.style, | ||
}) } %} | ||
{% block content %}{{ _children }}{% endblock %} | ||
{% endembed %} | ||
|
17 changes: 17 additions & 0 deletions
17
packages/web-twig/src/Resources/components/Toast/ToastBarMessage.twig
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,17 @@ | ||
{# API #} | ||
{%- set props = props | default([]) -%} | ||
|
||
{# Miscellaneous #} | ||
{%- set _styleProps = useStyleProps(props) -%} | ||
{%- set _textTruncateClassName = _spiritClassPrefix ~ 'text-truncate-multiline' -%} | ||
{%- set _classNames = [ _styleProps.className, _textTruncateClassName ] -%} | ||
|
||
|
||
<div | ||
{{ mainProps(props) }} | ||
{{ styleProp(_styleProps) }} | ||
{{ classProp(_classNames) }} | ||
data-spirit-populate-field="message" | ||
> | ||
{% block content %}{% endblock %} | ||
</div> |
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
14 changes: 14 additions & 0 deletions
14
packages/web-twig/src/Resources/components/Toast/__tests__/__fixtures__/toastBarLink.twig
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 @@ | ||
<ToastBarLink>ToastBar Link</ToastBarLink> | ||
|
||
<!-- Render with all props --> | ||
<ToastBarLink | ||
color="primary" | ||
href="https://www.google.com" | ||
target="_blank" | ||
isUnderlined={false} | ||
isDisabled={false} | ||
UNSAFE_className="custom-class" | ||
UNSAFE_style="outline: 5px solid blue; outline-offset: -5px;" | ||
> | ||
ToastBar Link | ||
</ToastBarLink> |
9 changes: 9 additions & 0 deletions
9
packages/web-twig/src/Resources/components/Toast/__tests__/__fixtures__/toastBarMessage.twig
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,9 @@ | ||
<ToastBarMessage>ToastBar Message</ToastBarMessage> | ||
|
||
<!-- Render with all props --> | ||
<ToastBarMessage | ||
UNSAFE_className="custom-class" | ||
UNSAFE_style="outline: 5px solid blue; outline-offset: -5px;" | ||
> | ||
ToastBar Message | ||
</ToastBarMessage> |
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.