Skip to content

Commit

Permalink
Feat(web-twig): Deprecate class in Stack #DS-646
Browse files Browse the repository at this point in the history
  • Loading branch information
crishpeen committed Apr 24, 2023
1 parent 755f75f commit 1a32535
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/web-twig/src/Resources/components/Stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ Without lexer:

| Prop name | Type | Default | Required | Description |
| ------------- | -------- | ------- | -------- | ------------------ |
| `class` | `string` | `null` | no | Custom CSS class |
| `elementType` | `string` | `div` | no | HTML tag to render |

You can add `id`, `data-*` or `aria-*` attributes to further extend component's
descriptiveness and accessibility.
descriptiveness and accessibility. Also, UNSAFE styling props are available,
see the [Escape hatches][escape-hatches] section in README to learn how and when to use them.

[stack]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web/src/scss/components/Stack
[escape-hatches]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web-twig/README.md#escape-hatches
6 changes: 3 additions & 3 deletions packages/web-twig/src/Resources/components/Stack/Stack.twig
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{# API #}
{%- set props = props | default([]) -%}
{%- set _class = props.class | default(null) -%}
{%- set _elementType = props.elementType | default('div') -%}

{# Class names #}
{%- set _rootClassName = _spiritClassPrefix ~ 'Stack' -%}

{# Miscellaneous #}
{%- set _classNames = [ _rootClassName, _class ] -%}
{%- set _styleProps = useStyleProps(props) -%}
{%- set _classNames = [ _rootClassName, _styleProps.className ] -%}

<{{ _elementType }} {{ mainProps(props) }} {{ classProp(_classNames) }}>
<{{ _elementType }} {{ mainProps(props) }} {{ styleProp(_styleProps) }} {{ classProp(_classNames) }}>
{%- block content %}{% endblock -%}
</{{ _elementType }}>

0 comments on commit 1a32535

Please sign in to comment.