rename align to text_align, so we can have item_align

This commit is contained in:
Torsten 2022-12-15 14:25:57 +02:00
parent 67dc8a07c3
commit 33bb02c8c8
11 changed files with 25 additions and 19 deletions

View File

@ -18,7 +18,7 @@ module Merged
{class: clazz} {class: clazz}
end end
def align_option(section , clazz = "") def text_align_option(section , clazz = "")
if section.has_option?("align") if section.has_option?("align")
# text-center , text-left , text-right , leave comment for tailwind # text-center , text-left , text-right , leave comment for tailwind
clazz += " text-#{section.option('align')}" clazz += " text-#{section.option('align')}"

View File

@ -1,6 +1,6 @@
.flex.flex-col{ options(section , :background , :color , :margin)} .flex.flex-col{ options(section , :background , :color , :margin)}
.flex.items-center.justify-center.flex-1 .flex.items-center.justify-center.flex-1
.max-w-prose.px-4.py-16.mx-auto.text-center{options(section , :align , :color)} .max-w-prose.px-4.py-16.mx-auto.text-center{options(section , :text_align , :color)}
%h1.text-2xl.font-bold.tracking-tight.sm:text-4xl %h1.text-2xl.font-bold.tracking-tight.sm:text-4xl
= section.header = section.header
-if section.has_option?("subheader") -if section.has_option?("subheader")

View File

@ -2,7 +2,7 @@
%div{ order_option(section)} %div{ order_option(section)}
= image_for( section , "h-56 w-full object-cover sm:h-full") = image_for( section , "h-56 w-full object-cover sm:h-full")
.p-8.md:p-12.lg:px-16.lg:py-24{ background_option(section)} .p-8.md:p-12.lg:px-16.lg:py-24{ background_option(section)}
.mx-auto.max-w-xl{options(section , :align , :color)} .mx-auto.max-w-xl{options(section , :text_align , :color)}
%h2.mt-12.text-2xl.font-bold.md:text-4xl %h2.mt-12.text-2xl.font-bold.md:text-4xl
= section.header = section.header
-if section.has_option?("subheader") -if section.has_option?("subheader")

View File

@ -1,7 +1,7 @@
.group.m-8.overflow-hidden.relative.flex.h-96.items-end .group.m-8.overflow-hidden.relative.flex.h-96.items-end
= image_for( card , "absolute inset-0 h-full w-full object-cover hover:scale-110 ease-in duration-700") = image_for( card , "absolute inset-0 h-full w-full object-cover hover:scale-110 ease-in duration-700")
.relative.w-full.m-2.p-4.tracking-widest{align_option(card ,"sm:w-1/2")} .relative.w-full.m-2.p-4.tracking-widest{text_align_option(card ,"sm:w-1/2")}
%div.transition-colors.group-hover:bg-black.group-hover:text-white{options(card , :align , :color , :background)} %div.transition-colors.group-hover:bg-black.group-hover:text-white{options(card , :text_align , :color , :background)}
.relative.w-full.m-2.p-4 .relative.w-full.m-2.p-4
%h3.text-lg %h3.text-lg
= card.header = card.header

View File

@ -1,7 +1,7 @@
.grid.grid-cols-1.gap-16.m-16 .grid.grid-cols-1.gap-16.m-16
%div{ order_option(card)} %div{ order_option(card)}
= image_for( card , "h-70 w-full object-cover grid") = image_for( card , "h-70 w-full object-cover grid")
%div.grid.h-70{options(card , :align , :color , :background )} %div.grid.h-70{options(card , :text_align , :color , :background )}
%h3.p-4.mt-10.text-3xl.font-bold= card.header %h3.p-4.mt-10.text-3xl.font-bold= card.header
-if card.has_option?("subheader") -if card.has_option?("subheader")
%h4.p-4.text-xl= card.option("subheader") %h4.p-4.text-xl= card.option("subheader")

View File

@ -1,7 +1,7 @@
.fex.flex-col.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm.m-10 .fex.flex-col.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm.m-10
= image_for( card , class: "object-fill") = image_for( card , class: "object-fill")
%h3.p-5.text-2xl.bg-gray-100.text-black.font-bold{ align_option(card)}= card.header %h3.p-5.text-2xl.bg-gray-100.text-black.font-bold{ text_align_option(card)}= card.header
%div.h-full{background_option(card)} %div.h-full{background_option(card)}
.p-5{options(card , :align , :color)} .p-5{options(card , :text_align , :color)}
%p.m-2.text-sm.leading-relaxed.line-clamp-3 %p.m-2.text-sm.leading-relaxed.line-clamp-3
= markdown(card) = markdown(card)

View File

@ -1,6 +1,6 @@
.m-10{background_option(card)} .m-10{background_option(card)}
= image_for( card , "h-96 w-full object-cover") = image_for( card , "h-96 w-full object-cover")
.m-6{options(card , :align , :color)} .m-6{options(card , :text_align , :color)}
%h3.p-4.text-2xl.font-bold= card.header %h3.p-4.text-2xl.font-bold= card.header
-if card.has_option?("subheader") -if card.has_option?("subheader")
%h4.p-4.text-xl= card.option("subheader") %h4.p-4.text-xl= card.option("subheader")

View File

@ -8,7 +8,7 @@
options: options:
- background - background
- color - color
- align - text_align
- template: card_gap_square - template: card_gap_square
header: Narrow card with up down section header: Narrow card with up down section
text: Smaller image, large margins, possible subheader text: Smaller image, large margins, possible subheader
@ -20,7 +20,7 @@
- background - background
- color - color
- order - order
- align - text_align
- subheader - subheader
- template: card_normal_square - template: card_normal_square
header: Standard card with square image header: Standard card with square image
@ -31,7 +31,7 @@
options: options:
- background - background
- color - color
- align - text_align
- subheader - subheader
- template: card_normal_round - template: card_normal_round
header: Standard card with square image header: Standard card with square image
@ -42,7 +42,7 @@
options: options:
- background - background
- color - color
- align - text_align
- template: form_field - template: form_field
header: A single field in a form header: A single field in a form
text: The header is the Name of the field, the description text: The header is the Name of the field, the description

View File

@ -27,7 +27,7 @@
:values: none black_25 white_25 light_red_25 light_blue_25 solid_blue_25 solid_red_25 :values: none black_25 white_25 light_red_25 light_blue_25 solid_blue_25 solid_red_25
:default: none :default: none
:id: 5 :id: 5
- :name: align - :name: text_align
:description: Align text of children. Normal Word meaning :description: Align text of children. Normal Word meaning
:values: left center right :values: left center right
:default: left :default: left
@ -87,3 +87,9 @@
:values: FormHandler :values: FormHandler
:default: FormHandler :default: FormHandler
:id: 16 :id: 16
- :name: item_align
:description: Alignment of actual children. Usually some kind of boxes.
Does not affect text, see text_align
:values: left center right
:default: left
:id: 17

View File

@ -37,13 +37,13 @@
- color - color
- subheader - subheader
- text - text
- align - text_align
- button_link - button_link
- button_text - button_text
- template: section_full_image - template: section_full_image
header: Full image header with adjustable text header: Full image header with adjustable text
text: Large picture background with Header and text on top. text: Large picture background with Header and text on top.
Adjustable alignment (left, center, right). Adjustable text text alignment (left, center, right).
Text may be slightly shaded for readability, Text may be slightly shaded for readability,
text color can be changed too. text color can be changed too.
fields: fields:
@ -52,12 +52,12 @@
options: options:
- fixed - fixed
- color - color
- align - text_align
- shade_color - shade_color
- template: section_large_image - template: section_large_image
header: Two third image header with adjustable text header: Two third image header with adjustable text
text: Large picture background with Header and text offset. text: Large picture background with Header and text offset.
Adjustable alignment (left, center, right). Adjustable text alignment (left, center, right).
Text section may have background color. Text section may have background color.
Text color can be changed too Text color can be changed too
fields: fields:

View File

@ -8,7 +8,7 @@ module Merged
expect(OptionDefinition.first.class).to be OptionDefinition expect(OptionDefinition.first.class).to be OptionDefinition
end end
it "there are options" do it "there are options" do
expect(OptionDefinition.all.length).to be 16 expect(OptionDefinition.all.length).to be 17
end end
it "has option objects" do it "has option objects" do
expect(first.class).to be OptionDefinition expect(first.class).to be OptionDefinition