Skip to content

Commit

Permalink
feat(dropdown): add the icon and iconVendor parameters (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Sep 25, 2023
1 parent 5988938 commit 006f3c1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions layouts/partials/bootstrap/dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
{{- $size := "" }}
{{- $class := "" }}
{{- $toggle := true }}
{{- $icon := "" }}
{{- $iconVendor := "bootstrap" }}
{{- if .IsNamedParams }}
{{- $name = .Get "name" }}
{{- with .Get "style" }}{{ $style = . }}{{ end }}
{{- with .Get "size" }}{{ $size = . }}{{ end }}
{{- with .Get "class" }}{{ $class = . }}{{ end }}
{{- if isset .Params "toggle" }}{{ $toggle = .Get "toggle" }}{{ end }}
{{- with .Get "icon" }}{{ $icon = . }}{{ end }}
{{- with .Get "iconVendor" }}{{ $iconVendor = . }}{{ end }}
{{- else }}
{{- $name = .Get 0 }}
{{- with .Get 1 }}{{ $style = . }}{{ end }}
Expand All @@ -24,6 +28,14 @@
class="{{ delimit $classes ` ` }}"
data-bs-toggle="dropdown"
aria-expanded="false">
{{- with $icon }}
{{ partial "icons/icon" (dict
"vendor" $iconVendor
"name" $icon
"height" "1em"
"width" "1em"
"className" "me-1") }}
{{- end }}
{{ $name }}
</button>
<ul class="dropdown-menu">
Expand Down

0 comments on commit 006f3c1

Please sign in to comment.