debut css pour pages ressources

This commit is contained in:
Ouidade Soussi Chiadmi 2025-02-28 13:36:24 +01:00
parent 0828edff55
commit a954720f71
10 changed files with 490 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -3467,6 +3467,7 @@ body {
.node-type-site .layout--threecol-25-50-25 .layout__region--third .block-region-third div {
display: flex;
flex-direction: row;
margin-bottom: 1rem;
}
@media (max-width: 500px) {
.node-type-site .layout--threecol-25-50-25 .layout__region--third .block-region-third div {
@ -3571,10 +3572,6 @@ body {
flex-direction: column;
}
.html.js.sr body.node-type-site.node-id-40 div.dialog-off-canvas-main-canvas div#page-node.layout-container main div.layout-content div.content_container div.layout.layout--threecol-25-50-25 div.layout__region.layout__region--third div.block-region-third div div.field_field_documents div div span {
visibility: hidden;
}
main {
background-color: #f6f7f3;
}
@ -3695,3 +3692,134 @@ main {
aspect-ratio: 1/1;
object-fit: cover;
}
#ressources {
background-color: #f6f7f3;
}
#ressources .layout-content .content_container {
display: flex;
flex-direction: column;
align-items: center;
}
#ressources .layout-content .content_container #block-quartiers-de-demain-titredepage {
margin-top: 1rem;
width: fit-content;
}
@media (max-width: 810px) {
#ressources .layout-content .content_container #block-quartiers-de-demain-titredepage {
margin-top: 14rem;
}
}
#ressources .layout-content .content_container #block-quartiers-de-demain-titredepage h1 {
text-transform: none;
color: black;
font-size: 2rem;
font-family: "gilroy-medium";
}
#ressources .layout-content .content_container .views-element-container {
margin-left: 15%;
width: 70%;
}
#ressources .layout-content .content_container .views-element-container .group-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
#ressources .layout-content .content_container .views-element-container .group-content h3 {
text-align: center;
flex: 0 0 100%;
}
#ressources .layout-content .content_container .views-element-container .group-content h3::before {
content: "";
display: block;
border-bottom: solid 2px rgb(7, 50, 194);
margin: auto;
}
#ressources .layout-content .content_container .views-element-container .group-content h3 div .field_name h2 a {
font-family: "gilroy-light";
color: rgb(7, 50, 194);
font-size: 2rem;
}
#ressources .layout-content .content_container .views-element-container .group-content h3 div .field_description {
font-family: "gilroy-light";
}
#ressources .layout-content .content_container .views-element-container .group-content .views-row {
width: 30%;
font-size: 0.5rem;
}
#ressources .layout-content .content_container .views-element-container .group-content .views-row h2 {
font-family: "gilroy-semibold";
color: rgb(7, 50, 194);
font-size: 0.6rem;
}
#ressources .layout-content .content_container .views-element-container .group-content .views-row p {
font-size: 0.5rem;
}
#ressources .layout-content .content_container .views-element-container .group-content .views-row .field_field_mots_clefs div {
display: flex;
flex-direction: row;
}
#ressources .layout-content .content_container .views-element-container .group-content .views-row .field_field_mots_clefs div div {
border: solid 1px rgb(7, 50, 194);
margin-right: 0.2rem;
padding: 1.3%;
padding-bottom: 0.2%;
padding-top: 0.2%;
font-size: 0.4rem;
font-family: "gilroy-semibold";
}
#ressources .layout-content .content_container .views-element-container .group-content .views-row .field_field_mots_clefs div div a {
color: rgb(7, 50, 194);
}
#ressources .layout-content .content_container .views-element-container .group-content .views-row .field_field_site div a {
position: relative;
padding-left: 20px;
color: rgb(247, 0, 43);
font-family: "gilroy-semibold";
}
#ressources .layout-content .content_container .views-element-container .group-content .views-row .field_field_site div a:before {
content: "";
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 1em;
height: 1em;
background-image: url("../img/map_pointer.svg");
background-size: contain;
background-repeat: no-repeat;
}
#ressources .group-content {
padding: 10px;
border-radius: 8px;
margin-bottom: 10px;
}
#ressources .views-row {
padding: 8px;
margin: 2px 0;
border-radius: 4px;
transition: max-height 0.5s ease, opacity 0.5s ease;
}
#ressources .hidden {
max-height: 0;
overflow: hidden;
opacity: 0;
}
#ressources .toggle-btn {
background: none;
color: rgb(7, 50, 194);
border: solid rgb(7, 50, 194) 1px;
padding: 8px 12px;
cursor: pointer;
margin-top: 5px;
display: block;
margin: auto;
width: 20%;
text-align: center;
transition: background 0.3s;
}
#ressources .toggle-btn:hover {
background: rgb(7, 50, 194);
color: white;
}

View File

@ -62,6 +62,7 @@ function quartiers_de_demain_preprocess_field(&$variables) {
}
}
/**
* Prepares variables for block templates.
*

View File

@ -685,6 +685,91 @@ document.addEventListener("DOMContentLoaded", function () {
});
//////////////////////////////////////////
/////////// Start script ressources ////////////////////////////////
document.addEventListener("DOMContentLoaded", () => {
const view = document.querySelector(".view");
const elements = Array.from(view.children);
let newView = document.createElement("div");
newView.classList.add("view");
let group = null;
let groupContent = null;
elements.forEach((el) => {
if (el.tagName === "H3") {
if (group) {
newView.appendChild(group);
}
group = document.createElement("div");
group.classList.add("group");
groupContent = document.createElement("div");
groupContent.classList.add("group-content");
groupContent.appendChild(el);
group.appendChild(groupContent);
} else if (el.classList.contains("views-row")) {
groupContent.appendChild(el);
}
});
if (group) {
newView.appendChild(group);
}
view.replaceWith(newView);
// Ajouter un bouton "Voir plus" dans chaque groupe
document.querySelectorAll(".group").forEach((group) => {
const rows = group.querySelectorAll(".views-row");
const button = document.createElement("button");
button.classList.add("toggle-btn");
button.textContent = "Voir plus de";
rows.forEach((row, index) => {
if (index >= 3) {
row.classList.add("hidden");
row.style.maxHeight = "0";
row.style.opacity = "0";
}
});
button.addEventListener("click", () => {
const isExpanded = button.textContent === "Voir moins de";
const hiddenRows = group.querySelectorAll(".views-row.hidden");
if (isExpanded) {
// Cacher les lignes avec un délai pour l'effet de transition
hiddenRows.forEach((row) => {
row.style.maxHeight = "0";
row.style.opacity = "0";
setTimeout(() => row.classList.add("hidden"), 500); // Délai pour la transition
});
} else {
// Afficher les lignes
hiddenRows.forEach((row) => {
row.classList.remove("hidden");
row.style.maxHeight = row.scrollHeight + "px";
row.style.opacity = "1";
});
}
button.textContent = isExpanded ? "Voir plus de" : "Voir moins de";
});
group.appendChild(button);
});
});
/////////// end script ressources ////////////////////////////////
})(jQuery, window);

View File

@ -0,0 +1,42 @@
#ressources{
.group-content {
// background: #f9f9f9;
padding: 10px;
border-radius: 8px;
margin-bottom: 10px;
// box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.views-row {
padding: 8px;
// background: #f3f3f3;
margin: 2px 0;
border-radius: 4px;
transition: max-height 0.5s ease, opacity 0.5s ease;
}
.hidden {
max-height: 0;
overflow: hidden;
opacity: 0;
}
.toggle-btn {
background: none;
color: $blue_QDD;
border: solid $blue_QDD 1px;
padding: 8px 12px;
cursor: pointer;
margin-top: 5px;
display: block;
margin: auto;
width: 20%;
text-align: center;
transition: background 0.3s;
}
.toggle-btn:hover {
background: $blue_QDD;
color:white;
}
}

View File

@ -340,6 +340,7 @@
div{
display: flex;
flex-direction: row;
margin-bottom: 1rem;
@media(max-width: 500px){
justify-content: center;
}
@ -460,6 +461,3 @@
display: flex;
flex-direction: column;
}
.html.js.sr body.node-type-site.node-id-40 div.dialog-off-canvas-main-canvas div#page-node.layout-container main div.layout-content div.content_container div.layout.layout--threecol-25-50-25 div.layout__region.layout__region--third div.block-region-third div div.field_field_documents div div span{
visibility: hidden;
}

View File

@ -0,0 +1,128 @@
#ressources{
background-color: #f6f7f3;
.layout-content{
// padding-top: 1rem;
.content_container{
display: flex;
flex-direction: column;
align-items: center;
#block-quartiers-de-demain-titredepage{
margin-top: 1rem;
width: fit-content;
@media(max-width: 810px){
margin-top: 14rem;
}
h1{
text-transform: none;
color: black;
font-size: 2rem;
font-family: "gilroy-medium"
}
}
.views-element-container{
margin-left: 15%;
width: 70%;
.group-content{
display: flex;
flex-direction: row;
flex-wrap: wrap;
h3{
&::before{
content:"";
display: block;
border-bottom: solid 2px $blue_QDD;
// width: 80% ;
margin: auto;
}
text-align: center;
// width: 100%;
flex: 0 0 100%;
div{
.field_name{
h2{
a{
font-family: "gilroy-light";
color: $blue_QDD;
font-size: 2rem;
}
}
}
.field_description{
font-family: "gilroy-light";
}
}
}
.views-row{
width: 30%;
font-size: 0.5rem;
h2{
font-family: "gilroy-semibold";
color: $blue_QDD;
font-size: 00.6rem;
}
p{
font-size: 0.5rem;
}
.field_field_mots_clefs{
div{
display: flex;
flex-direction: row;
div{
border: solid 1px $blue_QDD;
margin-right: 0.2rem;
padding: 1.3%;
padding-bottom: 0.2%;
padding-top: 0.2%;
font-size: 0.4rem;
font-family: "gilroy-semibold";
a{
color: $blue_QDD;
}
}
}
}
.field_field_site{
div {
a {
position: relative;
padding-left: 20px; // Ajuster selon la taille de l'icône
&:before {
content: "";
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 1em;
height: 1em;
background-image: url("../img/map_pointer.svg");
background-size: contain;
background-repeat: no-repeat;
}
color: $red_QDD;
font-family: "gilroy-semibold";
}
}
}
}
}
}
}
}
}

View File

@ -48,6 +48,8 @@
@import "pages/actualite";
@import "pages/node-type-site";
@import "pages/lessites.scss";
@import "pages/ressources";
@import "pages/bouton-ressources";
@import "/home/ouidade/Developer/docker-quartiersdedemain/src/web/modules/custom/q2d_mod/assets/css/carte-interactive-qdd.css";

View File

@ -0,0 +1,97 @@
{#
/**
* @file
* Claro's theme implementation to display a single Drupal page.
*
* The doctype, html, head, and body tags are not in this template. Instead
* they can be found in the html.html.twig template normally located in the
* core/modules/system directory.
*
* Available variables:
*
* General utility variables:
* - base_path: The base URL path of the Drupal installation. Will usually be
* "/" unless you have installed Drupal in a sub-directory.
* - is_front: A flag indicating if the current page is the front page.
* - logged_in: A flag indicating if the user is registered and signed in.
* - is_admin: A flag indicating if the user has permission to access
* administration pages.
*
* Site identity:
* - front_page: The URL of the front page. Use this instead of base_path when
* linking to the front page. This includes the language domain or prefix.
*
* Page content (in order of occurrence in the default page.html.twig):
* - node: Fully loaded node, if there is an automatically-loaded node
* associated with the page and the node ID is the second argument in the
* page's path (e.g. node/12345 and node/12345/revisions, but not
* comment/reply/12345).
*
* Regions:
* - page.header: Items for the header region.
* - page.pre_content: Items for the pre-content region.
* - page.breadcrumb: Items for the breadcrumb region.
* - page.highlighted: Items for the highlighted region.
* - page.help: Dynamic help text, mostly for admin pages.
* - page.content: The main content of the current page.
*
* @see template_preprocess_page()
* @see html.html.twig
*/
#}
<div class="layout-container" id="ressources">
<header role="banner">
{{ page.header_left }}
{{ page.header_right }}
{{ page.header_nav }}
</header>
{{ page.primary_menu }}
{{ page.secondary_menu }}
{{ page.breadcrumb }}
{{ page.highlighted }}
{{ page.help }}
<main role="main">
<a id="main-content" tabindex="-1"></a>{# link is in html.html.twig #}
<div class="layout-content">
{{ page.content }}
</div>{# /.layout-content #}
{% if page.sidebar_first %}
<aside class="layout-sidebar-first" role="complementary">
{{ page.sidebar_first }}
</aside>
{% endif %}
{% if page.sidebar_second %}
<aside class="layout-sidebar-second" role="complementary">
{{ page.sidebar_second }}
</aside>
{% endif %}
</main>
{# {% if page.footer_top or page.footer_left or page.footer_middle or page.footer_right or page.footer_bottom %} #}
<footer role="contentinfo">
{# <section id="footer-top"> #}
<span class="totop"><a href="#" id="toTop"><i class="arrow-up"></i></a></span>
{# </section> #}
<div class="footer">
<section id="footer-left">{{ page.footer_left }}</section>
<div class='first-row'>
<section id="footer-middle">{{ page.footer_middle }}</section>
<section id="footer-right">{{ page.footer_right }}</section>
</div>
</div>
{# <section id="footer-bottom">{{ page.footer_bottom }}</section> #}
</footer>
{# {% endif %} #}
</div>{# /.layout-container #}