bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Docs: fix StackBlitz examples needing icons

Open julien-deramond opened this issue 2 years ago • 1 comments

Description

This PR takes into account the issue reported in https://github.com/twbs/bootstrap/issues/39499 (the issue has been closed by OP but is still there in our documentation).

As explained in https://github.com/twbs/bootstrap/issues/39499#issuecomment-1858783774, the problem is that we don't embed the icons in these cases that come from site/layouts/partials/icons.html.

The idea of this PR is to add a parameter to handle this specific use case like it's done for the optional JavaScript snippet. Whenever an {{ example }} needs the icons, we only need to use the new stackblitz_add_icons parameter and set it to true like this: {{< example stackblitz_add_icons="true" >}}.

Note: I haven't checked the whole documentation to add this parameter, only the icon-link page.

Type of changes

  • [x] Bug fix (non-breaking change which fixes an issue)

Checklist

  • [x] I have read the contributing guidelines
  • [x] My code follows the code style of the project (using npm run lint)
  • [x] My change introduces changes to the documentation
  • [x] I have updated the documentation accordingly
  • (N/A) I have added tests to cover my changes
  • [x] All new and existing tests passed

Live previews

  • https://deploy-preview-39505--twbs-bootstrap.netlify.app/docs/5.3/helpers/icon-link/
  • https://deploy-preview-39505--twbs-bootstrap.netlify.app/docs/5.3/components/accordion/ (for non-regression testing: the <svg> containing the icons shouldn't be in StackBlitz)

Related issues

Closes #39499

julien-deramond avatar Dec 18 '23 08:12 julien-deramond

Haven't checked in details but what would you think about an approach like in Alerts (2nd example) ?

louismaximepiton avatar Jan 25 '24 16:01 louismaximepiton

I'm probably more in favor of what @louismaximepiton suggested—it's a good point that makes these snippets easier to copy-paste across a number of environments. Thoughts?

mdo avatar Mar 18 '24 19:03 mdo

Thanks for your suggestions, I'm closing this PR in favour of https://github.com/twbs/bootstrap/pull/39799 that supersedes it taking in account your comments

julien-deramond avatar Mar 19 '24 06:03 julien-deramond