Skip to content

Commit

Permalink
fix: tabs styling in steps shortcode (#440)
Browse files Browse the repository at this point in the history
* fix: tabs styling in steps shortcode

* docs: add notes for intended usage
  • Loading branch information
imfing authored Aug 18, 2024
1 parent 2863a3a commit 526be88
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions exampleSite/content/docs/guide/shortcodes/steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ This is the third step.

## Usage

{{< callout emoji="ℹ️" >}}
Please note that this shortcode is intended **only for Markdown content**.
If you put HTML content or other shortcodes as step content, it may not render as expected.
{{< /callout >}}

Put Markdown h3 header within `steps` shortcode.

```
Expand Down
7 changes: 4 additions & 3 deletions layouts/shortcodes/tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
class="hextra-tabs-panel hx-rounded hx-pt-6 hx-hidden data-[state=selected]:hx-block"
id="tabs-panel-{{ .Ordinal }}"
role="tabpanel"
{{ if eq .Ordinal $defaultIndex }}tabindex="0"{{ end }}
{{ if eq .Ordinal $defaultIndex }}data-state="selected"{{ end }}
{{- if eq .Ordinal $defaultIndex }} tabindex="0" {{ end -}}
{{- if eq .Ordinal $defaultIndex }} data-state="selected" {{ end -}}
>
{{ .InnerDeindent | markdownify }}
{{- .InnerDeindent | markdownify -}}
</div>
{{- /* Drop trailing newlines */ -}}
9 changes: 5 additions & 4 deletions layouts/shortcodes/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
role="tab"
type="button"
aria-controls="tabs-panel-{{ $i }}"
{{ if eq $i $defaultIndex }}aria-selected="true"{{ end }}
{{ if eq $i $defaultIndex }}tabindex="0"{{ end }}
{{ if eq $i $defaultIndex }}data-state="selected"{{ end }}
{{- if eq $i $defaultIndex }} aria-selected="true" {{ end -}}
{{- if eq $i $defaultIndex }} tabindex="0" {{ end -}}
{{- if eq $i $defaultIndex }} data-state="selected"{{ end -}}
>
{{- $item -}}
</button>
{{- end -}}
</div>
</div>
<div>
{{ .Inner }}
{{- .Inner -}}
</div>
{{- /* Drop trailing newlines */ -}}

0 comments on commit 526be88

Please sign in to comment.