From 3a15e58ee38dae847ff877c261ce9856e00c74fb Mon Sep 17 00:00:00 2001 From: Torsten Date: Sat, 28 Jan 2023 14:37:08 +0200 Subject: [PATCH] more margin option, with name --- app/assets/stylesheets/merged/merged.css | 8 ++++++++ app/helpers/merged/options_helper.rb | 19 ++++++++----------- config/merged/option_definitions.yml | 4 ++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/assets/stylesheets/merged/merged.css b/app/assets/stylesheets/merged/merged.css index 8d07d55..be2d667 100644 --- a/app/assets/stylesheets/merged/merged.css +++ b/app/assets/stylesheets/merged/merged.css @@ -3101,6 +3101,14 @@ select { margin: 5rem; } + .xl\:m-8 { + margin: 2rem; + } + + .xl\:m-14 { + margin: 3.5rem; + } + .xl\:mx-auto { margin-left: auto; margin-right: auto; diff --git a/app/helpers/merged/options_helper.rb b/app/helpers/merged/options_helper.rb index 36016c7..8a34fa1 100644 --- a/app/helpers/merged/options_helper.rb +++ b/app/helpers/merged/options_helper.rb @@ -75,10 +75,13 @@ module Merged end def margin_option(section , clazz = "") - if section.has_option?("margin") - clazz += margin_for(section) - end - {class: clazz} + return {class: clazz} unless section.has_option?("margin") + margin = { "none" => " m-0" , + "small" => " 2 md:4 lg:6 xl:m-8" , + "medium" => " 5 md:8 lg:10 xl:m-14" , + "large" => " 8 md:12 lg:16 xl:m-20" , + }[section.option("margin")] || "" + {class: clazz + margin} end def text_color_option(section , clazz = "") @@ -145,13 +148,7 @@ module Merged "solid_black" => " bg-slate-900" , }[section.option('background')] || "" end - # need full margin names for tailwind to pick it up - def margin_for( section ) - { "0" => " m-0" , - "none" => "" , - "20" => " 8 md:12 lg:16 xl:m-20" , - }[section.option("margin")] || "" - end + # need full color names for tailwind to pick it up def color_for( section ) { "white" => " text-white", diff --git a/config/merged/option_definitions.yml b/config/merged/option_definitions.yml index 39550bc..147d424 100644 --- a/config/merged/option_definitions.yml +++ b/config/merged/option_definitions.yml @@ -42,8 +42,8 @@ - :name: margin :description: Most sections have standard margin of 20. This option makes it possible to remove that - :values: 0 20 - :default: 20 + :values: none small medium large + :default: large :id: 8 - :name: button_text :description: Text for an optional button. Must also set button_link