Skip to content

Commit

Permalink
Feat(web-twig): Rename divider classes according to the Figma documen…
Browse files Browse the repository at this point in the history
…tation

  * use start, end and intermediate instead of top, bottom and middle

refs #DS-571
  • Loading branch information
literat committed May 2, 2023
1 parent 38e8263 commit 7cbf2bd
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions packages/web-twig/src/Resources/components/Stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Basic example usage:
Advanced example usage:

```html
<Stack elementType="ul" hasMiddleDividers hasTopDivider hasBottomDivider>
<Stack elementType="ul" hasIntermediateDividers hasStartDivider hasEndDivider>
<li>
<div>List item 1</div>
</li>
Expand Down Expand Up @@ -50,13 +50,13 @@ Without lexer:

## API

| Prop name | Type | Default | Required | Description |
| ------------------- | -------- | ------- | -------- | -------------------------------------- |
| `elementType` | `string` | `div` | no | Element type of the wrapper element |
| `hasBottomDivider` | `bool` | `false` | no | Render a divider after the last item |
| `hasMiddleDividers` | `bool` | `false` | no | Render dividers between items |
| `hasSpacing` | `bool` | `false` | no | Apply a spacing between items |
| `hasTopDivider` | `bool` | `false` | no | Render a divider before the first item |
| Prop name | Type | Default | Required | Description |
| ------------------------- | -------- | ------- | -------- | -------------------------------------- |
| `elementType` | `string` | `div` | no | Element type of the wrapper element |
| `hasEndDivider` | `bool` | `false` | no | Render a divider after the last item |
| `hasIntermediateDividers` | `bool` | `false` | no | Render dividers between items |
| `hasSpacing` | `bool` | `false` | no | Apply a spacing between items |
| `hasStartDivider` | `bool` | `false` | no | Render a divider before the first item |

You can add `id`, `data-*` or `aria-*` attributes to further extend component's
descriptiveness and accessibility. Also, UNSAFE styling props are available,
Expand Down
12 changes: 6 additions & 6 deletions packages/web-twig/src/Resources/components/Stack/Stack.twig
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{# API #}
{%- set props = props | default([]) -%}
{%- set _elementType = props.elementType | default('div') -%}
{%- set _hasBottomDivider = props.hasBottomDivider | default(false) | boolprop -%}
{%- set _hasMiddleDividers = props.hasMiddleDividers | default(false) | boolprop -%}
{%- set _hasEndDivider = props.hasEndDivider | default(false) | boolprop -%}
{%- set _hasIntermediateDividers = props.hasIntermediateDividers | default(false) | boolprop -%}
{%- set _hasSpacing = props.hasSpacing | default(false) | boolprop -%}
{%- set _hasTopDivider = props.hasTopDivider | default(false) | boolprop -%}
{%- set _hasStartDivider = props.hasStartDivider | default(false) | boolprop -%}

{# Class names #}
{%- set _rootClassName = _spiritClassPrefix ~ 'Stack' -%}
{%- set _rootBottomDividerClassName = _hasBottomDivider ? _spiritClassPrefix ~ 'Stack--hasBottomDivider' : null -%}
{%- set _rootMiddleDividersClassName = _hasMiddleDividers ? _spiritClassPrefix ~ 'Stack--hasMiddleDividers' : null -%}
{%- set _rootBottomDividerClassName = _hasEndDivider ? _spiritClassPrefix ~ 'Stack--hasEndDivider' : null -%}
{%- set _rootMiddleDividersClassName = _hasIntermediateDividers ? _spiritClassPrefix ~ 'Stack--hasIntermediateDividers' : null -%}
{%- set _rootSpacingClassName = _hasSpacing ? _spiritClassPrefix ~ 'Stack--hasSpacing' : null -%}
{%- set _rootTopDividerClassName = _hasTopDivider ? _spiritClassPrefix ~ 'Stack--hasTopDivider' : null -%}
{%- set _rootTopDividerClassName = _hasStartDivider ? _spiritClassPrefix ~ 'Stack--hasStartDivider' : null -%}

{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<h3 class="docs-Heading">Stacked Blocks with Inner and Outer Dividers and Vertical Spacing</h3>

<Stack elementType="ul" hasSpacing hasMiddleDividers hasTopDivider hasBottomDivider>
<Stack elementType="ul" hasSpacing hasIntermediateDividers hasStartDivider hasEndDivider>
{% for i in 1..3 %}
<li>
<div class="docs-Box">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<h3 class="docs-Heading">Stacked Blocks with Inner Dividers and Vertical Spacing</h3>

<Stack elementType="ul" hasSpacing hasMiddleDividers>
<Stack elementType="ul" hasSpacing hasIntermediateDividers>
{% for i in 1..3 %}
<li>
<div class="docs-Box">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<h3 class="docs-Heading">Stacked Blocks with Vertical Spacing</h3>

<Stack elementType="ul" hasMiddleDividers>
<Stack elementType="ul" hasIntermediateDividers>
{% for i in 1..3 %}
<li>
<div class="docs-Box">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title></title>
</head>
<body>
<div class="Stack Stack--hasBottomDivider Stack--hasMiddleDividers Stack--hasTopDivider">
<div class="Stack Stack--hasEndDivider Stack--hasIntermediateDividers Stack--hasStartDivider">
<div>
Block 1
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title></title>
</head>
<body>
<ul class="Stack Stack--hasBottomDivider Stack--hasMiddleDividers Stack--hasSpacing Stack--hasTopDivider">
<ul class="Stack Stack--hasEndDivider Stack--hasIntermediateDividers Stack--hasSpacing Stack--hasStartDivider">
<li>
<div>
List item 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Stack hasBottomDivider hasMiddleDividers hasTopDivider>
<Stack hasEndDivider hasIntermediateDividers hasStartDivider>
<div>Block 1</div>
<div>Block 2</div>
<div>Block 3</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Stack elementType="ul" hasBottomDivider hasMiddleDividers hasTopDivider hasSpacing>
<Stack elementType="ul" hasEndDivider hasIntermediateDividers hasStartDivider hasSpacing>
<li>
<div>List item 1</div>
</li>
Expand Down

0 comments on commit 7cbf2bd

Please sign in to comment.