Skip to content

Commit

Permalink
Feat(web-twig): Deprecate icon for danger color in Alert component
Browse files Browse the repository at this point in the history
  * the `warning` icon for the `danger` color is marked as deprecated
  * the `danger` icon for the `danger` color will be used as default in the next major version

refs #DS-1156
  • Loading branch information
literat committed Feb 23, 2024
1 parent 3f52be6 commit bfa14b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/web-twig/src/Resources/components/Alert/Alert.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@
{% elseif _color == 'warning' %}
{%- set _iconNameByColor = 'warning' -%}
{% elseif _color == 'danger' %}
{# @TODO: set the value to the `danger` in https://jira.almacareer.tech/browse/DS-1177 #}
{%- set _iconNameByColor = 'warning' -%}
{% endif %}
{%- set _iconNameValue = _iconName | default(_iconNameByColor) -%}

{# Deprecations #}
{% if _color == 'danger' %}
{% deprecated 'Alert: The "warning" icon for the "danger" color is deprecated. Make sure you have the "danger" icon between your assets.
Fallback to the "warning" icon will be removed in favor of the "danger" icon in the next major version.' %}
{% endif %}

<{{ _elementType }} {{ mainProps(props) }} {{ styleProp(_styleProps) }} {{ classProp(_classNames) }} role="alert">
<Icon name="{{ _iconNameValue }}" />
<div>
Expand Down
7 changes: 6 additions & 1 deletion packages/web-twig/src/Resources/components/Alert/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ Without lexer:

| Color name | Icon name |
| ------------- | ------------- |
| `danger` | `warning` |
| `danger` | `warning`\* |
| `default` | `info` |
| `informative` | `info` |
| `success` | `check-plain` |
| `warning` | `warning` |

(\*) The `warning` icon for the `danger` color has been marked as [deprecated].
Please make sure you have the `danger` icon in your project between your assets.
The `warning` icon for the `danger` color will be removed in favor of the `danger` icon in the next major version.

## API

| Name | Type | Default | Required | Description |
Expand All @@ -55,6 +59,7 @@ If you need more control over the styling of a component, you can use [style pro
and [escape hatches][readme-escape-hatches].

[alert]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web/src/scss/components/Alert
[deprecated]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web-twig/README.md#deprecations
[dictionary-color]: https://github.com/lmc-eu/spirit-design-system/tree/main/docs/DICTIONARIES.md#color
[icon-package]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/icons
[readme-additional-attributes]: https://github.com/lmc-eu/spirit-design-system/blob/main/packages/web-twig/README.md#additional-attributes
Expand Down

0 comments on commit bfa14b0

Please sign in to comment.