Skip to content

Commit

Permalink
feat(dropdown): add the toggle parameter for showing/hiding the dropd…
Browse files Browse the repository at this point in the history
…own toggle (#81)
  • Loading branch information
razonyang authored Sep 25, 2023
1 parent 7888b2a commit 41d6449
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion layouts/partials/bootstrap/dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
{{- $style := "primary" }}
{{- $size := "" }}
{{- $class := "" }}
{{- $toggle := true }}
{{- $items := slice }}
{{- 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 }}
{{- else }}
{{- $name = .Get 0 }}
{{- with .Get 1 }}{{ $style = . }}{{ end }}
{{- with .Get 2 }}{{ $size = . }}{{ end }}
{{- end }}
{{- $classes := slice "btn" (printf "btn-%s" $style) "dropdown-toggle" }}
{{- $classes := slice "btn" (printf "btn-%s" $style) }}
{{- if $toggle }}{{ $classes = $classes | append "dropdown-toggle" }}{{ end }}
{{- with $size }}{{ $classes = $classes | append (printf "btn-%s" .) }}{{ end }}
{{- with $class }}{{ $classes = $classes | append $class }}{{ end }}
<div class="dropdown">
Expand Down

0 comments on commit 41d6449

Please sign in to comment.