Skip to content

Commit

Permalink
feat: add the container shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jun 28, 2023
1 parent 72cd00a commit 853f21a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions layouts/partials/bootstrap/container.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- $breakpoint := "" }}
{{- $class := "" }}
{{- if .IsNamedParams }}
{{- $breakpoint = .Get "breakpoint" }}
{{- $class = .Get "class" }}
{{- else }}
{{- $breakpoint = .Get 0 }}
{{- $class = .Get 1 }}
{{- end }}
{{- $classes := slice }}
{{- if $breakpoint }}
{{- $classes = $classes | append (printf "container-%s" $breakpoint) }}
{{- else }}
{{- $classes = $classes | append "container" }}
{{- end }}
{{- with $class }}{{ $classes = $classes | append . }}{{ end }}
<div class="{{ delimit $classes ` ` }}">
{{ .Inner }}
</div>
2 changes: 2 additions & 0 deletions layouts/shortcodes/bootstrap/container.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{- if .Inner }}{{ end }}
{{- partial "bootstrap/container" . }}
2 changes: 2 additions & 0 deletions layouts/shortcodes/bs/container.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{- if .Inner }}{{ end }}
{{- partial "bootstrap/container" . }}

0 comments on commit 853f21a

Please sign in to comment.