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}
end
def align_option(section , clazz = "")
def text_align_option(section , clazz = "")
if section.has_option?("align")
# text-center , text-left , text-right , leave comment for tailwind
clazz += " text-#{section.option('align')}"

View File

@ -1,6 +1,6 @@
.flex.flex-col{ options(section , :background , :color , :margin)}
.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
= section.header
-if section.has_option?("subheader")

View File

@ -2,7 +2,7 @@
%div{ order_option(section)}
= 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)}
.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
= section.header
-if section.has_option?("subheader")

View File

@ -1,7 +1,7 @@
.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")
.relative.w-full.m-2.p-4.tracking-widest{align_option(card ,"sm:w-1/2")}
%div.transition-colors.group-hover:bg-black.group-hover:text-white{options(card , :align , :color , :background)}
.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 , :text_align , :color , :background)}
.relative.w-full.m-2.p-4
%h3.text-lg
= card.header

View File

@ -1,7 +1,7 @@
.grid.grid-cols-1.gap-16.m-16
%div{ order_option(card)}
= 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
-if card.has_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
= 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)}
.p-5{options(card , :align , :color)}
.p-5{options(card , :text_align , :color)}
%p.m-2.text-sm.leading-relaxed.line-clamp-3
= markdown(card)

View File

@ -1,6 +1,6 @@
.m-10{background_option(card)}
= 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
-if card.has_option?("subheader")
%h4.p-4.text-xl= card.option("subheader")

View File

@ -8,7 +8,7 @@
options:
- background
- color
- align
- text_align
- template: card_gap_square
header: Narrow card with up down section
text: Smaller image, large margins, possible subheader
@ -20,7 +20,7 @@
- background
- color
- order
- align
- text_align
- subheader
- template: card_normal_square
header: Standard card with square image
@ -31,7 +31,7 @@
options:
- background
- color
- align
- text_align
- subheader
- template: card_normal_round
header: Standard card with square image
@ -42,7 +42,7 @@
options:
- background
- color
- align
- text_align
- template: form_field
header: A single field in a form
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
:default: none
:id: 5
- :name: align
- :name: text_align
:description: Align text of children. Normal Word meaning
:values: left center right
:default: left
@ -87,3 +87,9 @@
:values: FormHandler
:default: FormHandler
: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
- subheader
- text
- align
- text_align
- button_link
- button_text
- template: section_full_image
header: Full image header with adjustable text
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 color can be changed too.
fields:
@ -52,12 +52,12 @@
options:
- fixed
- color
- align
- text_align
- shade_color
- template: section_large_image
header: Two third image header with adjustable text
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 color can be changed too
fields:

View File

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