From: Jérémy Fabre Date: Wed, 27 Jul 2016 14:43:43 +0000 (+0200) Subject: Implement the page_block style X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=fba2273a67aa91f7ac4ff7427a905a0087969be6;p=mezzo.git Implement the page_block style --- diff --git a/app/static/src/sass/modules/_all.scss b/app/static/src/sass/modules/_all.scss index cca25cef..b82ae6ad 100755 --- a/app/static/src/sass/modules/_all.scss +++ b/app/static/src/sass/modules/_all.scss @@ -4,6 +4,10 @@ @import "navs/nav-footer"; @import "navs/nav-tree"; +// Boxes +@import 'boxes/article-box'; +@import 'boxes/page-box'; + // Page modules @import 'breadcrumb'; @import 'pagination'; @@ -12,7 +16,6 @@ @import 'lang-switcher'; @import 'search'; @import 'pattern'; -@import 'article-box'; @import 'tag'; // Typography modules diff --git a/app/static/src/sass/modules/_article-box.scss b/app/static/src/sass/modules/_article-box.scss deleted file mode 100644 index c6d494a6..00000000 --- a/app/static/src/sass/modules/_article-box.scss +++ /dev/null @@ -1,137 +0,0 @@ -$module: ".article-box"; - -#{$module} { - - position: relative; - background: white; - display: block; - @include margin-bottom(1); - @include transition(all 0.25s ease-in-out); - - &:hover { - box-shadow: 0px 0px 14px 0px rgba(0,0,0,0.17); - .article-box__image { - &:after { - border-width: 12px; - } - } - } - - &__header { - position: relative; - } - - &__image { - margin: 0; - padding: 0; - width: 100%; - position: relative; - - img { - display: block; - width: 100%; - max-width: 100%; - height: auto; - } - - &:after { - content: ''; - display: block; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - border-width: 0px; - border-color: white; - border-style: solid; - @include transition(all 0.25s ease-in-out); - } - } - - &__tags { - position: absolute; - bottom: 0; - left: 0; - - @include margin-bottom(.55); - } - - &__btn { - position: absolute; - bottom: 0; - right: 0; - - @include margin-bottom(.5); - @include margin-right(.5); - } - - &__content { - @include padding(.25 .25 1 .25); - - position: relative; - height: 250px; - overflow: hidden; - - @include mq($until: xs) { - height: auto; - } - - &:after { - - @include mq($until: xs) { - display: none; - } - - content: ""; - display: block; - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 100px; - background-color: rgba(255,255,255,0); - @include filter-gradient(#ffffff, #ffffff, vertical); - @include background-image(linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 50%)); - } - } - - &__title { - @include font-size(xl); - @include line-height(1.25); - @include typeface(sans-serif); - @include margin(0 0 .25 0); - } - - &__subtitle { - @include font-size(s); - @include line-height(.75); - @include typeface(serif); - @include margin-top(.25); - font-weight: weight(regular); - } - - &__desc { - @include font-size(s); - @include line-height(.75); - @include typeface(serif); - @include margin(1 0 .25 0); - font-weight: weight(light); - } - - &--small { - - .article-box__content { - height: auto; - &:after { - display: none; - } - } - - .article-box__btn { - display: none; - } - - } - -} diff --git a/app/static/src/sass/modules/boxes/_article-box.scss b/app/static/src/sass/modules/boxes/_article-box.scss new file mode 100644 index 00000000..c6d494a6 --- /dev/null +++ b/app/static/src/sass/modules/boxes/_article-box.scss @@ -0,0 +1,137 @@ +$module: ".article-box"; + +#{$module} { + + position: relative; + background: white; + display: block; + @include margin-bottom(1); + @include transition(all 0.25s ease-in-out); + + &:hover { + box-shadow: 0px 0px 14px 0px rgba(0,0,0,0.17); + .article-box__image { + &:after { + border-width: 12px; + } + } + } + + &__header { + position: relative; + } + + &__image { + margin: 0; + padding: 0; + width: 100%; + position: relative; + + img { + display: block; + width: 100%; + max-width: 100%; + height: auto; + } + + &:after { + content: ''; + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border-width: 0px; + border-color: white; + border-style: solid; + @include transition(all 0.25s ease-in-out); + } + } + + &__tags { + position: absolute; + bottom: 0; + left: 0; + + @include margin-bottom(.55); + } + + &__btn { + position: absolute; + bottom: 0; + right: 0; + + @include margin-bottom(.5); + @include margin-right(.5); + } + + &__content { + @include padding(.25 .25 1 .25); + + position: relative; + height: 250px; + overflow: hidden; + + @include mq($until: xs) { + height: auto; + } + + &:after { + + @include mq($until: xs) { + display: none; + } + + content: ""; + display: block; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 100px; + background-color: rgba(255,255,255,0); + @include filter-gradient(#ffffff, #ffffff, vertical); + @include background-image(linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 50%)); + } + } + + &__title { + @include font-size(xl); + @include line-height(1.25); + @include typeface(sans-serif); + @include margin(0 0 .25 0); + } + + &__subtitle { + @include font-size(s); + @include line-height(.75); + @include typeface(serif); + @include margin-top(.25); + font-weight: weight(regular); + } + + &__desc { + @include font-size(s); + @include line-height(.75); + @include typeface(serif); + @include margin(1 0 .25 0); + font-weight: weight(light); + } + + &--small { + + .article-box__content { + height: auto; + &:after { + display: none; + } + } + + .article-box__btn { + display: none; + } + + } + +} diff --git a/app/static/src/sass/modules/boxes/_page-box.scss b/app/static/src/sass/modules/boxes/_page-box.scss new file mode 100644 index 00000000..81080e31 --- /dev/null +++ b/app/static/src/sass/modules/boxes/_page-box.scss @@ -0,0 +1,66 @@ +$module: ".page-box"; + +#{$module} { + + position: relative; + width: 100%; + display: block; + + @include margin-bottom(1); + + &__image { + + @include fluid-aspect(9 4, "img"); + + &:after { + content: ''; + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + + background: rgba(0, 0, 0, 0.4); + @include transition(all 0.25s ease-in-out); + } + + } + + &__content { + + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + + display: flex; + align-items: center; + justify-content: center; + text-align: center; + + @include padding(1); + + } + + &__title { + + color: $color-main; + font-weight: weight(heavy); + + @include margin(0 0 1 0); + + } + + &__subtitle { + + color: white; + font-weight: weight(bold); + + @include font-size(m); + @include margin(0 0 1 0); + + } + +} diff --git a/app/static/src/sass/utils/_mixins.scss b/app/static/src/sass/utils/_mixins.scss index e69de29b..3ad2773c 100755 --- a/app/static/src/sass/utils/_mixins.scss +++ b/app/static/src/sass/utils/_mixins.scss @@ -0,0 +1,14 @@ +@mixin fluid-aspect($ratio: 1 1, $selector: "> :first-child") { + $selector: unquote($selector); + + padding-bottom: percentage(nth($ratio, 2) / nth($ratio, 1)); + position: relative; + + #{$selector} { + left: 0; + height: 100%; + position: absolute; + top: 0; + width: 100%; + } +} diff --git a/app/templates/pages/includes/page_card.html b/app/templates/pages/includes/page_card.html index 6f79fef7..40bbd8cc 100644 --- a/app/templates/pages/includes/page_card.html +++ b/app/templates/pages/includes/page_card.html @@ -1,4 +1,13 @@ - - {{ object.title }} - {{ object.basicpage.sub_title }} + +
+ +
+
+
+

{{ object.title }}

+
+ {{ object.basicpage.sub_title }} +
+
+