Skip to content

Commit

Permalink
feat(dropdown): add the class parameter to specify the extra class na…
Browse files Browse the repository at this point in the history
…mes (#79)
  • Loading branch information
razonyang committed Sep 25, 2023
1 parent 39af14a commit 7888b2a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion layouts/partials/bootstrap/dropdown.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
{{- $name := "" }}
{{- $style := "primary" }}
{{- $size := "" }}
{{- $class := "" }}
{{- $items := slice }}
{{- if .IsNamedParams }}
{{- $name = .Get "name" }}
{{- with .Get "style" }}{{ $style = . }}{{ end }}
{{- with .Get "size" }}{{ $size = . }}{{ end }}
{{- with .Get "class" }}{{ $class = . }}{{ end }}
{{- else }}
{{- $name = .Get 0 }}
{{- with .Get 1 }}{{ $style = . }}{{ end }}
{{- with .Get 2 }}{{ $size = . }}{{ end }}
{{- end }}
{{- $classes := slice "btn" (printf "btn-%s" $style) "dropdown-toggle" }}
{{- with $size }}{{ $classes = $classes | append (printf "btn-%s" .) }}{{ end }}
{{- with $class }}{{ $classes = $classes | append $class }}{{ end }}
<div class="dropdown">
<button
type="button"
class="btn btn-{{ $style }} dropdown-toggle{{ with $size }} btn-{{ . }}{{ end }}"
class="{{ delimit $classes ` ` }}"
data-bs-toggle="dropdown"
aria-expanded="false">
{{ $name }}
Expand Down

0 comments on commit 7888b2a

Please sign in to comment.