resposivness fixes, bg image alignment

This commit is contained in:
2023-01-01 14:33:12 +02:00
parent 93f6a1924b
commit fb43a75817
14 changed files with 44 additions and 28 deletions

View File

@ -30,7 +30,7 @@ module Merged
def order_option(section , clazz = "")
if section.has_option?("order")
clazz += " order-last" if section.option('order') == "right"
clazz += " md:order-last" if section.option('order') == "right"
end
{class: clazz}
end

View File

@ -12,14 +12,18 @@ module Merged
# background image as inline style
def bg(section , clazz = "")
attributes = {class: clazz}
return attributes if section.image.blank?
return {class: clazz} if section.image.blank?
img = asset_url( section.image.asset_name )
attributes["style"] = "background-image: url('#{img}');"
style = "background-image: url('#{img}');"
if(section.option("fixed") == "on")
attributes[:class] = attributes[:class] + " bg-fixed"
clazz += " bg-fixed"
end
attributes
if(align = section.option("image_align"))
align += "-bottom" unless align == "center"
# for tailwind: bg-left-bottom bg-right-bottom bg-center
clazz += " bg-#{align}"
end
{class: clazz , style: style}
end
# works for with sections and cards that respond to .image