From d926f5d1c1369e4429bdccd49c85ce1a6779ed54 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Sun, 27 Nov 2022 13:52:22 +0100 Subject: [PATCH] block base class --- assets/sass/_theme/blocks/base.sass | 18 +++++++++++------- .../blocks/templates/call_to_action.html | 2 +- layouts/partials/blocks/templates/chapter.html | 2 +- layouts/partials/blocks/templates/contact.html | 2 +- .../partials/blocks/templates/datatable.html | 2 +- .../partials/blocks/templates/definitions.html | 2 +- layouts/partials/blocks/templates/embed.html | 2 +- layouts/partials/blocks/templates/files.html | 2 +- layouts/partials/blocks/templates/gallery.html | 2 +- layouts/partials/blocks/templates/image.html | 2 +- .../partials/blocks/templates/key_figures.html | 2 +- .../blocks/templates/organization_chart.html | 2 +- layouts/partials/blocks/templates/pages.html | 4 ++-- .../partials/blocks/templates/partners.html | 2 +- layouts/partials/blocks/templates/posts.html | 2 +- .../partials/blocks/templates/programs.html | 2 +- .../blocks/templates/testimonials.html | 2 +- .../partials/blocks/templates/timeline.html | 2 +- layouts/partials/blocks/templates/video.html | 2 +- 19 files changed, 30 insertions(+), 26 deletions(-) diff --git a/assets/sass/_theme/blocks/base.sass b/assets/sass/_theme/blocks/base.sass index d8fcbc90..de7fde9d 100644 --- a/assets/sass/_theme/blocks/base.sass +++ b/assets/sass/_theme/blocks/base.sass @@ -1,7 +1,11 @@ -[class^="block-"] - @include in-page-with-sidebar - h2, h3 - @extend .h2 - @include in-page-without-sidebar - h2, h3 - @extend .h5 \ No newline at end of file +.blocks + .block:first-of-type + margin-top: 0 + .block + margin-top: $spacing5 + @include in-page-with-sidebar + h2, h3 + @extend .h2 + @include in-page-without-sidebar + h2, h3 + @extend .h5 \ No newline at end of file diff --git a/layouts/partials/blocks/templates/call_to_action.html b/layouts/partials/blocks/templates/call_to_action.html index fcd70e26..2fae0fcd 100644 --- a/layouts/partials/blocks/templates/call_to_action.html +++ b/layouts/partials/blocks/templates/call_to_action.html @@ -3,7 +3,7 @@ {{- $title := .block.title -}} {{- with .block.data -}} {{- $buttons := and .button.text .button_secondary.text -}} - <section class="block-call_to_action{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-call_to_action{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> <div class="call_to_action call_to_action--with{{ if not .image }}out{{ end }}-image"> diff --git a/layouts/partials/blocks/templates/chapter.html b/layouts/partials/blocks/templates/chapter.html index a7f5a881..417e2719 100644 --- a/layouts/partials/blocks/templates/chapter.html +++ b/layouts/partials/blocks/templates/chapter.html @@ -1,7 +1,7 @@ {{- $context := .context -}} {{- $position := .block.position -}} {{- $title := .block.title -}} -{{- $class := "block-chapter" -}} +{{- $class := "block block-chapter" -}} {{- with .block.data -}} {{ if .image }} {{- $class = printf "%s block-chapter--with-image" $class -}} diff --git a/layouts/partials/blocks/templates/contact.html b/layouts/partials/blocks/templates/contact.html index 26993d37..75cb945c 100644 --- a/layouts/partials/blocks/templates/contact.html +++ b/layouts/partials/blocks/templates/contact.html @@ -1,7 +1,7 @@ {{- $context := .context -}} {{- $position := .block.position -}} {{- $title := .block.title -}} -{{- $class := "block-contact" -}} +{{- $class := "block block-contact" -}} {{- with .block.data -}} <section class="{{ $class }}{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> diff --git a/layouts/partials/blocks/templates/datatable.html b/layouts/partials/blocks/templates/datatable.html index b9a9fc92..a07cf8b9 100644 --- a/layouts/partials/blocks/templates/datatable.html +++ b/layouts/partials/blocks/templates/datatable.html @@ -3,7 +3,7 @@ {{- $title := .block.title -}} {{- $title := .block.title -}} {{- with .block.data -}} - <section class="block-datatable{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-datatable{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{- if $title }} diff --git a/layouts/partials/blocks/templates/definitions.html b/layouts/partials/blocks/templates/definitions.html index 46eb0adb..4adc1bab 100644 --- a/layouts/partials/blocks/templates/definitions.html +++ b/layouts/partials/blocks/templates/definitions.html @@ -2,7 +2,7 @@ {{- $position := .block.position -}} {{- $title := .block.title -}} {{- with .block.data -}} - <section class="block-definitions{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-definitions{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{- if $title }} diff --git a/layouts/partials/blocks/templates/embed.html b/layouts/partials/blocks/templates/embed.html index 157a4968..263eb21e 100644 --- a/layouts/partials/blocks/templates/embed.html +++ b/layouts/partials/blocks/templates/embed.html @@ -2,7 +2,7 @@ {{- $position := .block.position -}} {{- $title := .block.title -}} {{- with .block.data -}} - <section class="block-embed{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-embed{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{- if $title }} diff --git a/layouts/partials/blocks/templates/files.html b/layouts/partials/blocks/templates/files.html index 2b81f50d..780fabc6 100644 --- a/layouts/partials/blocks/templates/files.html +++ b/layouts/partials/blocks/templates/files.html @@ -2,7 +2,7 @@ {{- $position := .block.position -}} {{- $title := .block.title -}} {{- with .block.data -}} - <section class="block-files{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-files{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{- if $title }} diff --git a/layouts/partials/blocks/templates/gallery.html b/layouts/partials/blocks/templates/gallery.html index 83aa6f6a..00dc4caf 100644 --- a/layouts/partials/blocks/templates/gallery.html +++ b/layouts/partials/blocks/templates/gallery.html @@ -7,7 +7,7 @@ {{- if $layout -}} {{- $layout_class = printf "block-gallery--%s" .layout -}} {{- end -}} - <section class="block-gallery{{ if $title }} block-with-title{{ end }} {{ $layout_class }}" id="block-{{ $position }}"> + <section class="block block-gallery{{ if $title }} block-with-title{{ end }} {{ $layout_class }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{- if (or $title .description) }} diff --git a/layouts/partials/blocks/templates/image.html b/layouts/partials/blocks/templates/image.html index 84e1ab73..4b9f1769 100644 --- a/layouts/partials/blocks/templates/image.html +++ b/layouts/partials/blocks/templates/image.html @@ -3,7 +3,7 @@ {{- $title := .block.title -}} {{- with .block.data -}} {{- $buttons := and .button.text .button_secondary.text -}} - <section class="block-image{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-image{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{/* TODO: refactor */}} diff --git a/layouts/partials/blocks/templates/key_figures.html b/layouts/partials/blocks/templates/key_figures.html index 856371fe..97d10727 100644 --- a/layouts/partials/blocks/templates/key_figures.html +++ b/layouts/partials/blocks/templates/key_figures.html @@ -2,7 +2,7 @@ {{- $position := .block.position -}} {{- $title := .block.title -}} {{- with .block.data -}} - <section class="block-key_figures{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-key_figures{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{- if (or $title .description) }} diff --git a/layouts/partials/blocks/templates/organization_chart.html b/layouts/partials/blocks/templates/organization_chart.html index 0ffa8dc3..d2b27ac6 100644 --- a/layouts/partials/blocks/templates/organization_chart.html +++ b/layouts/partials/blocks/templates/organization_chart.html @@ -3,7 +3,7 @@ {{- $title := .block.title -}} {{- with .block.data -}} {{- $with_link := .with_link -}} -<section class="block-organization_chart{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> +<section class="block block-organization_chart{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{ if (or $title .description) -}} diff --git a/layouts/partials/blocks/templates/pages.html b/layouts/partials/blocks/templates/pages.html index 4b9b233a..aa73cd59 100644 --- a/layouts/partials/blocks/templates/pages.html +++ b/layouts/partials/blocks/templates/pages.html @@ -1,7 +1,7 @@ {{- $context := .context -}} {{- $position := .block.position -}} {{- $title := .block.title -}} -{{- $layout_class := "block-pages--grid" -}} +{{- $layout_class := "block block-pages--grid" -}} {{- with .block.data -}} {{- $layout := .layout -}} @@ -36,7 +36,7 @@ {{ end }} {{ end -}} - <section class="block-pages{{ if $title }} block-with-title{{ end }} {{ $layout_class }} {{ $page_class }}" id="block-{{ $position }}"> + <section class="block block-pages{{ if $title }} block-with-title{{ end }} {{ $layout_class }} {{ $page_class }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> diff --git a/layouts/partials/blocks/templates/partners.html b/layouts/partials/blocks/templates/partners.html index 21374093..451ae964 100644 --- a/layouts/partials/blocks/templates/partners.html +++ b/layouts/partials/blocks/templates/partners.html @@ -2,7 +2,7 @@ {{- $position := .block.position -}} {{- $title := .block.title -}} {{- with .block.data -}} - <section class="block-partners{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-partners{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{ if (or $title .description) -}} diff --git a/layouts/partials/blocks/templates/posts.html b/layouts/partials/blocks/templates/posts.html index 210a8074..b218bad1 100644 --- a/layouts/partials/blocks/templates/posts.html +++ b/layouts/partials/blocks/templates/posts.html @@ -6,7 +6,7 @@ {{ if .category }} {{- $term = site.GetPage (printf "/categories%s" .category) -}} {{ end }} - <section class="block-posts{{ if $title }} block-with-title{{ end }} {{ if $term }} term-{{ replace $term.Slug "/" "" }} {{- end -}}" id="block-{{ $position }}"> + <section class="block block-posts{{ if $title }} block-with-title{{ end }} {{ if $term }} term-{{ replace $term.Slug "/" "" }} {{- end -}}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{ if $title -}} diff --git a/layouts/partials/blocks/templates/programs.html b/layouts/partials/blocks/templates/programs.html index d32ed8c2..a783e9d5 100644 --- a/layouts/partials/blocks/templates/programs.html +++ b/layouts/partials/blocks/templates/programs.html @@ -2,7 +2,7 @@ {{- $position := .block.position -}} {{- $title := .block.title -}} {{- with .block.data -}} - <section class="block-programs{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-programs{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{ if $title -}} diff --git a/layouts/partials/blocks/templates/testimonials.html b/layouts/partials/blocks/templates/testimonials.html index 0c09398a..b2ec3959 100644 --- a/layouts/partials/blocks/templates/testimonials.html +++ b/layouts/partials/blocks/templates/testimonials.html @@ -7,7 +7,7 @@ {{ if gt (len .testimonials) 1 }} {{- $is_carousel = true -}} {{ end }} - <section class="block-testimonials{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-testimonials{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> {{ if $title -}} diff --git a/layouts/partials/blocks/templates/timeline.html b/layouts/partials/blocks/templates/timeline.html index 61109571..a66546ec 100644 --- a/layouts/partials/blocks/templates/timeline.html +++ b/layouts/partials/blocks/templates/timeline.html @@ -2,7 +2,7 @@ {{- $position := .block.position -}} {{- $title := .block.title -}} {{- $layout := .block.data.layout | default "vertical" -}} -<section class="block-timeline{{ if $title }} block-with-title{{ end }} block-timeline--{{ $layout }}" id="block-{{ $position }}"> +<section class="block block-timeline{{ if $title }} block-with-title{{ end }} block-timeline--{{ $layout }}" id="block-{{ $position }}"> <div class="container"> {{ $template := printf "blocks/templates/timeline/%s.html" $layout }} {{ partial $template (dict diff --git a/layouts/partials/blocks/templates/video.html b/layouts/partials/blocks/templates/video.html index 60532489..1d96d895 100644 --- a/layouts/partials/blocks/templates/video.html +++ b/layouts/partials/blocks/templates/video.html @@ -2,7 +2,7 @@ {{- $position := .block.position -}} {{- $title := .block.title -}} {{- with .block.data -}} - <section class="block-video{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> + <section class="block block-video{{ if $title }} block-with-title{{ end }}" id="block-{{ $position }}"> <div class="container"> <div class="block-content"> <div> -- GitLab