centered layout with columns breakpoints

This commit is contained in:
Bachir Soussi Chiadmi 2019-06-17 16:50:16 +02:00
parent 88dc7b7ea4
commit 625f6eb84b
10 changed files with 332 additions and 16 deletions

View File

@ -23,7 +23,7 @@ dependencies:
- field.field.node.materiau.field_thesaurus
- field.field.node.materiau.field_video
- field.field.node.materiau.field_workflow
- image.style.medium
- image.style.card_medium
- node.type.materiau
module:
- image_delta_formatter
@ -35,20 +35,20 @@ mode: teaser
content:
field_materiau_images:
type: image_delta_formatter
weight: 0
weight: 1
region: content
label: hidden
settings:
deltas: '0'
image_style: medium
image_style: card_medium
image_link: ''
deltas_reversed: 0
third_party_settings: { }
title:
label: hidden
type: string
weight: -5
weight: 0
region: content
label: hidden
settings:
link_to_entity: false
third_party_settings: { }

File diff suppressed because one or more lines are too long

View File

@ -8,10 +8,36 @@ body, html{
margin:0;
padding:0;
}
body{
overflow-x:hidden;
}
div.dialog-off-canvas-main-canvas{
width: 100vw;
}
body.toolbar-horizontal.toolbar-themes.toolbar-no-tabs{
padding-top: 24px!important;
}
%grided-width{
margin:0 auto;
$m: $column_goutiere;
$colw: $column_width;
$bp: $colw + $m;
@while $bp < 4096px {
$upbp: $bp + $colw + $m;
@media only screen and (min-width: $bp + 1px) and (max-width: $upbp) {
width:$bp - $m;
}
$bp: $upbp;
}
// outline:1px blue solid;
// &>*{
// outline:1px red solid;
// }
}
// _ _ _
// | || |___ __ _ __| |___ _ _
@ -19,14 +45,17 @@ body.toolbar-horizontal.toolbar-themes.toolbar-no-tabs{
// |_||_\___\__,_\__,_\___|_|
header[role="banner"]{
background-color: #fff;
overflow: visible;
position: fixed;
z-index: 20;
width:100vw;
// outline: 1px solid blue;
height: $header_height;
.wrapper{
@extend %grided-width;
// box-sizing:border-box;
.header-block{
min-height: 15px;
font-size: 0;
@ -50,5 +79,8 @@ header[role="banner"]{
// |_| |_\__,_|_|_||_|
main[role="main"]{
@extend %grided-width;
padding-top: $header_height+8px;
}

View File

@ -1,3 +1,6 @@
$base_font_size:16px;
$header_height: 60px;
$column_width: 210px;
$column_goutiere: 15px;

View File

@ -118,6 +118,7 @@ header[role="banner"]{
}
#block-languageswitcher{
text-align: right;
h2{
margin: 0.1em 0 0 0;
font-size: 0.756em;
@ -132,7 +133,8 @@ header[role="banner"]{
&>ul.links{
// background-color: #fff;
overflow: hidden;
width:5em;
width:3.5em;
// display: inline-block;
height:1px;
padding:0.01em 0;
margin:0;
@ -152,6 +154,7 @@ header[role="banner"]{
li{
list-style: none;
padding:0;
display: inline-block;
&.is-active{
display:none;
}
@ -206,6 +209,7 @@ aside.messages{
text-indent: 50px;
overflow: hidden;
width:20px; height:20px;
margin:0;
// border-radius: 7px;
background-image: url('../img/search.png');
background-position: center;
@ -238,13 +242,21 @@ article.node--type-frontpage{
}
}
.field--name-computed-materials-reference,
// .field--name-computed-materials-reference,
.field--name-computed-showrooms-reference,
.field--name-computed-articles-reference{
// outline: 1px green solid;
margin:0; padding:0;
width: calc(100% + #{$column_goutiere});
.field__item{
display: inline-block;
vertical-align: top;
max-width:250px;
width:210px;
margin:0 $column_goutiere $column_goutiere 0; padding:0;
p{
margin:0;
}
}
}
}
@ -266,23 +278,28 @@ article.node--type-frontpage{
.cards-list{
position: relative;
.search-info{
margin:0 0 1em 0;
}
&>ul{
// outline: 1px green solid;
margin:0; padding:0;
width: calc(100% + #{$column_goutiere});
&>li{
list-style: none;
margin:0 1em 1em 0; padding:0;
margin:0 $column_goutiere $column_goutiere 0; padding:0;
display: inline-block;
vertical-align: top;
}
}
}
.card{
article.card{
position: relative;
width:210px; height:295px;
width:$column_width; height:295px;
box-shadow: 0 0 5px rgba(0,0,0,0.2);
// focused
// box-shadow: 0 0 7px rgba(0,0,0,0.9);

View File

@ -79,6 +79,11 @@ function materiotheme_preprocess_page(&$vars){
// ));
// }
function materiotheme_preprocess_node_materiau_teaser(&$vars){
// $vars['attributes']['class'] = 'card';
// kint($vars['attributes']);
}
/**
* Implements hook_form_alter
*/

View File

@ -0,0 +1,67 @@
{#
/**
* @file
* Default theme implementation for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
* Drupal templates such as page.html.twig or node.html.twig.
*
* Instead of overriding the theming for all fields, you can also just override
* theming for a subset of fields using
* @link themeable Theme hook suggestions. @endlink For example,
* here are some theme hook suggestions that can be used for a field_foo field
* on an article node type:
* - field--node--field-foo--article.html.twig
* - field--node--field-foo.html.twig
* - field--node--article.html.twig
* - field--field-foo.html.twig
* - field--text-with-summary.html.twig
* - field.html.twig
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
* - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item's content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
* @see template_preprocess_field()
*
* @ingroup themeable
*/
#}
{%
set title_classes = [
label_display == 'visually_hidden' ? 'visually-hidden',
]
%}
<div class="cards-list">
{% if label_hidden %}
<ul{{ attributes }}>
{% for item in items %}
<li{{ item.attributes }}>{{ item.content }}</li>
{% endfor %}
</ul>
{% else %}
<div{{ attributes }}>
<div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
{% if multiple %}
<ul>
{% endif %}
{% for item in items %}
<li{{ item.attributes }}>{{ item.content }}</li>
{% endfor %}
{% if multiple %}
</ul>
{% endif %}
</div>
{% endif %}
</div>

View File

@ -0,0 +1,84 @@
{#
/**
* @file
* Default theme implementation to display a node.
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - node.getCreatedTime() will return the node creation timestamp.
* - node.hasField('field_example') returns TRUE if the node bundle includes
* field_example. (This does not indicate the presence of a value in this
* field.)
* - node.isPublished() will return whether the node is published or not.
* Calling other methods, such as node.delete(), will result in an exception.
* See \Drupal\node\Entity\Node for a full list of public properties and
* methods for the node object.
* - label: (optional) The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given child element.
* - author_picture: The node author user entity, rendered using the "compact"
* view mode.
* - metadata: Metadata for this node.
* - date: (optional) Themed creation date field.
* - author_name: (optional) Themed author name field.
* - url: Direct URL of the current node.
* - display_submitted: Whether submission information should be displayed.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - node: The current template type (also known as a "theming hook").
* - node--type-[type]: The current node type. For example, if the node is an
* "Article" it would result in "node--type-article". Note that the machine
* name will often be in a short form of the human readable label.
* - node--view-mode-[view_mode]: The View Mode of the node; for example, a
* teaser would result in: "node--view-mode-teaser", and
* full: "node--view-mode-full".
* The following are controlled through the node publishing options.
* - node--promoted: Appears on nodes promoted to the front page.
* - node--sticky: Appears on nodes ordered above other non-sticky nodes in
* teaser listings.
* - node--unpublished: Appears on unpublished nodes visible only to site
* admins.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - content_attributes: Same as attributes, except applied to the main
* content tag that appears in the template.
* - author_attributes: Same as attributes, except applied to the author of
* the node tag that appears in the template.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
* - view_mode: View mode; for example, "teaser" or "full".
* - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
* - page: Flag for the full page state. Will be true if view_mode is 'full'.
* - readmore: Flag for more state. Will be true if the teaser content of the
* node cannot hold the main body content.
* - logged_in: Flag for authenticated user status. Will be true when the
* current user is a logged-in member.
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
* @see template_preprocess_node()
*
* @todo Remove the id attribute (or make it a class), because if that gets
* rendered twice on a page this is invalid CSS for example: two lists
* in different view modes.
*
* @ingroup themeable
*/
#}
<article{{ attributes.addClass('card') }}>
<header>
<h1>{{ label }}</h1>
<!-- <h4>{{ content.field_description }}</h4>
<span class="ref">{{ content.field_reference }}</span> -->
</header>
<section class="images">
{{ content.field_materiau_images }}
</section>
</article>

View File

@ -0,0 +1,108 @@
{#
/**
* @file
* Theme override to display a node.
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - node.getCreatedTime() will return the node creation timestamp.
* - node.hasField('field_example') returns TRUE if the node bundle includes
* field_example. (This does not indicate the presence of a value in this
* field.)
* - node.isPublished() will return whether the node is published or not.
* Calling other methods, such as node.delete(), will result in an exception.
* See \Drupal\node\Entity\Node for a full list of public properties and
* methods for the node object.
* - label: (optional) The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given child element.
* - author_picture: The node author user entity, rendered using the "compact"
* view mode.
* - metadata: Metadata for this node.
* - date: (optional) Themed creation date field.
* - author_name: (optional) Themed author name field.
* - url: Direct URL of the current node.
* - display_submitted: Whether submission information should be displayed.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - node: The current template type (also known as a "theming hook").
* - node--type-[type]: The current node type. For example, if the node is an
* "Article" it would result in "node--type-article". Note that the machine
* name will often be in a short form of the human readable label.
* - node--view-mode-[view_mode]: The View Mode of the node; for example, a
* teaser would result in: "node--view-mode-teaser", and
* full: "node--view-mode-full".
* The following are controlled through the node publishing options.
* - node--promoted: Appears on nodes promoted to the front page.
* - node--sticky: Appears on nodes ordered above other non-sticky nodes in
* teaser listings.
* - node--unpublished: Appears on unpublished nodes visible only to site
* admins.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - content_attributes: Same as attributes, except applied to the main
* content tag that appears in the template.
* - author_attributes: Same as attributes, except applied to the author of
* the node tag that appears in the template.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
* - view_mode: View mode; for example, "teaser" or "full".
* - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
* - page: Flag for the full page state. Will be true if view_mode is 'full'.
* - readmore: Flag for more state. Will be true if the teaser content of the
* node cannot hold the main body content.
* - logged_in: Flag for authenticated user status. Will be true when the
* current user is a logged-in member.
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
* @see template_preprocess_node()
*
* @todo Remove the id attribute (or make it a class), because if that gets
* rendered twice on a page this is invalid CSS for example: two lists
* in different view modes.
*/
#}
{%
set classes = [
'node',
'node--type-' ~ node.bundle|clean_class,
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
]
%}
{{ attach_library('classy/node') }}
<article{{ attributes.addClass(classes) }}>
{{ title_prefix }}
{% if label and not page %}
<h2{{ title_attributes }}>
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
</h2>
{% endif %}
{{ title_suffix }}
{% if display_submitted %}
<footer class="node__meta">
{{ author_picture }}
<div{{ author_attributes.addClass('node__submitted') }}>
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
{{ metadata }}
</div>
</footer>
{% endif %}
<div{{ content_attributes.addClass('node__content') }}>
{{ content }}
</div>
</article>

View File

@ -1,5 +1,5 @@
<template>
<div class="card">
<article class="card">
<header>
<h1>{{ item.title }}</h1>
<h4>{{ item.description }}</h4>
@ -19,7 +19,7 @@
<img class="blank" :src="blanksrc">
</figure>
</section>
</div>
</article>
</template>
<script>