Skip to content

Commit

Permalink
Temp commit with a beginning of a solution...
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahiss committed Sep 11, 2024
1 parent 429e0c3 commit 6fc3ed5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion site/content/docs/5.3/components/accordion.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ To render an accordion that's expanded by default:

Add `.accordion-flush` to remove some borders and rounded corners to render accordions edge-to-edge with their parent container.

{{< example class="bg-body-secondary" >}}
{{< example class="bg-body-secondary" buttons_labels="flush accordion example">}}
<div class="accordion accordion-flush" id="accordionFlushExample">
<div class="accordion-item">
<h2 class="accordion-header">
Expand Down
9 changes: 7 additions & 2 deletions site/layouts/shortcodes/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* show_markup: if the markup should be output in the HTML - default: `true`
* show_preview: if the preview should be output in the HTML - default: `true`
* stackblitz_add_js: if extra JS snippet should be added to StackBlitz - default: `false`
* buttons_labels: label to apply to complete 'Try it on Stackblitz' and 'Copy to clipboard' buttons - default: ""
*/ -}}

{{- $id := .Get "id" -}}
Expand All @@ -16,10 +17,14 @@
{{- $show_markup := .Get "show_markup" | default true -}}
{{- $show_preview := .Get "show_preview" | default true -}}
{{- $stackblitz_add_js := .Get "stackblitz_add_js" | default false -}}
{{- $buttons_labels := .Get "buttons_labels" | default "" -}}

{{- $content := .Inner -}}

<div class="bd-example-snippet bd-code-snippet">
{{- if eq $buttons_labels "" }}toto{{ else }} {{ $buttons_labels }} {{- end }}
{{- if not (eq $buttons_labels "") }} {{ $buttons_labels }} {{- end }}

{{- if eq $show_preview true }}
<div{{ with $id }} id="{{ . }}"{{ end }} class="bd-example m-0 border-0{{ with $class }} {{ . }}{{ end }}">
{{ $content }}
Expand All @@ -31,10 +36,10 @@
<div class="d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-0 border-top border-bottom">
<small class="font-monospace text-body-secondary text-uppercase">{{ $lang }}</small>
<div class="d-flex ms-auto">
<button type="button" class="btn-edit text-nowrap"{{ with $stackblitz_add_js }} data-sb-js-snippet="{{ $stackblitz_add_js }}"{{ end }} title="Try it on StackBlitz">
<button type="button" class="btn-edit text-nowrap"{{ with $stackblitz_add_js }} data-sb-js-snippet="{{ $stackblitz_add_js }}"{{ end }} title="Try {{- if eq $buttons_labels "" }} it{{ else }} {{ $buttons_labels }} {{- end }} on StackBlitz">
<svg class="bi" aria-hidden="true"><use xlink:href="#lightning-charge-fill"/></svg>
</button>
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy {{- if eq $buttons_labels "" }} {{ else }} {{ $buttons_labels }} {{- end }}to clipboard">
<svg class="bi" aria-hidden="true"><use xlink:href="#clipboard"/></svg>
</button>
</div>
Expand Down

0 comments on commit 6fc3ed5

Please sign in to comment.