Skip to content

Commit

Permalink
feat(close button): add eco-design variant (#1489)
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Déramond <julien.deramond@orange.com>
  • Loading branch information
louismaximepiton and julien-deramond committed Jul 10, 2023
1 parent ef20beb commit 841b0d5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
40 changes: 38 additions & 2 deletions site/content/docs/5.3/components/close-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ Add `.btn-close-white` to the `.btn-close` for a dark variant.
<button type="button" class="btn-close btn-close-white" disabled data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Close"><span class="visually-hidden">Close</span></button>
{{< /example >}}

## Without specific class
## Eco-design variant

Close buttons can also be created without `.btn-close` to reduce the size of your CSS bundle.
{{< callout info >}}
For eco-design reasons, close buttons can also be created without `.btn-close` to reduce the size of your CSS bundle. It means that you don't have to import `_close.scss` in your Sass file if you are an advanced Boosted user using **custom Sass imports**.

If you choose this option, please be aware that if the design of close buttons change in the future, this section might disappear and you would have to use `.btn-close` to your close buttons or change the combinations of classes.
{{< /callout >}}

{{< example stackblitz_add_js="true" >}}
<button type="button" class="btn btn-icon btn-no-outline" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Close">
Expand All @@ -47,6 +51,38 @@ Close buttons can also be created without `.btn-close` to reduce the size of you
<svg width="1.25rem" height="1.25rem" fill="currentColor" aria-hidden="true" focusable="false"><use xlink:href="/docs/{{< param docs_version >}}/assets/img/boosted-sprite.svg#delete"></use></svg>
<span class="visually-hidden">Close</span>
</button>

<button type="button" class="btn btn-icon btn-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Close">
<svg width="1.25rem" height="1.25rem" fill="currentColor" aria-hidden="true" focusable="false"><use xlink:href="/docs/{{< param docs_version >}}/assets/img/boosted-sprite.svg#delete"></use></svg>
<span class="visually-hidden">Close</span>
</button>

<button type="button" class="btn btn-icon btn-secondary" disabled data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Close">
<svg width="1.25rem" height="1.25rem" fill="currentColor" aria-hidden="true" focusable="false"><use xlink:href="/docs/{{< param docs_version >}}/assets/img/boosted-sprite.svg#delete"></use></svg>
<span class="visually-hidden">Close</span>
</button>
{{< /example >}}

{{< example class="bg-dark" >}}
<button type="button" class="btn btn-icon btn-no-outline btn-inverse" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Close">
<svg width="1.25rem" height="1.25rem" fill="currentColor" aria-hidden="true" focusable="false"><use xlink:href="/docs/{{< param docs_version >}}/assets/img/boosted-sprite.svg#delete"></use></svg>
<span class="visually-hidden">Close</span>
</button>

<button type="button" class="btn btn-icon btn-no-outline btn-inverse" disabled data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Close">
<svg width="1.25rem" height="1.25rem" fill="currentColor" aria-hidden="true" focusable="false"><use xlink:href="/docs/{{< param docs_version >}}/assets/img/boosted-sprite.svg#delete"></use></svg>
<span class="visually-hidden">Close</span>
</button>

<button type="button" class="btn btn-icon btn-secondary btn-inverse" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Close">
<svg width="1.25rem" height="1.25rem" fill="currentColor" aria-hidden="true" focusable="false"><use xlink:href="/docs/{{< param docs_version >}}/assets/img/boosted-sprite.svg#delete"></use></svg>
<span class="visually-hidden">Close</span>
</button>

<button type="button" class="btn btn-icon btn-secondary btn-inverse" disabled data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Close">
<svg width="1.25rem" height="1.25rem" fill="currentColor" aria-hidden="true" focusable="false"><use xlink:href="/docs/{{< param docs_version >}}/assets/img/boosted-sprite.svg#delete"></use></svg>
<span class="visually-hidden">Close</span>
</button>
{{< /example >}}

{{% enable-btn-close-tooltip 2 %}}
Expand Down
1 change: 1 addition & 0 deletions site/content/docs/5.3/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Learn more by reading the new [color modes documentation]({{< docsref "/customiz

- **Close button**
- <span class="badge bg-success">New</span> A tooltip was added on close buttons. Please add this tooltip in your websites, by adding the attributes `data-bs-toggle`, `data-bs-placement` and `data-bs-title`.
- <span class="badge bg-success">New</span> Added an eco-design variant.

- **Footer**
- <span class="badge bg-warning">Warning</span> For accessibility reasons, having a `aria-labelledby` on the collapse element in the accordions used in footer is not necessary and can be removed. Be careful to not remove the corresponding `id` if used for other purposes. Please reflect these modifications into your websites.
Expand Down

0 comments on commit 841b0d5

Please sign in to comment.