From 7888b2af98fce93c3c40fead1b4f93d71bef7457 Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Mon, 25 Sep 2023 14:28:09 +0800 Subject: [PATCH] feat(dropdown): add the class parameter to specify the extra class names (#79) --- layouts/partials/bootstrap/dropdown.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/layouts/partials/bootstrap/dropdown.html b/layouts/partials/bootstrap/dropdown.html index 78db9ed..8e14ac2 100644 --- a/layouts/partials/bootstrap/dropdown.html +++ b/layouts/partials/bootstrap/dropdown.html @@ -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 }}