Explorar o código

feat(widget): add option to customize section spacing

Close #433
George Cushen %!s(int64=6) %!d(string=hai) anos
pai
achega
aa8b3f35ba
Modificáronse 2 ficheiros con 10 adicións e 1 borrados
  1. 5 1
      exampleSite/content/home/demo.md
  2. 5 0
      layouts/partials/widget_page.html

+ 5 - 1
exampleSite/content/home/demo.md

@@ -35,9 +35,13 @@ subtitle = ""
   # Text color (true=light or false=dark).
   text_color_light = true
 
+[design.spacing]
+  # Customize the section spacing. Order is top, right, bottom, left.
+  padding = ["20px", "0", "20px", "0"]
+
 [advanced]
  # Custom CSS. 
- css_style = "padding-top: 20px; padding-bottom: 20px;"
+ css_style = ""
  
  # CSS class.
  css_class = ""

+ 5 - 0
layouts/partials/widget_page.html

@@ -36,6 +36,11 @@
     {{ $style = printf "%sbackground-image: %s url('%s');" $style $darken (printf "img/%s" $bg.image | absURL) }}
   {{ end }}
 
+  {{ with $st.Params.design.spacing.padding }}
+    {{ $style_pad := printf "padding: %s;" (delimit . " ") }}
+    {{ $style = print $style $style_pad }}
+  {{ end }}
+
   {{ with $st.Params.advanced.css_style }}
     {{ $style = print $style . }}
   {{ end }}