REmoving things.
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
name: Accordion
|
||||
props:
|
||||
type: object
|
||||
properties: { }
|
||||
properties:
|
||||
accordionType:
|
||||
type: string
|
||||
title: Accordion Type
|
||||
description: 'The type of accordion.'
|
||||
slots:
|
||||
# Content.
|
||||
accordion_headline:
|
||||
title: Accordion Title
|
||||
description: "The accordion title."
|
||||
accordion_content:
|
||||
title: Accordion Content
|
||||
description: "The accordion content."
|
||||
headline:
|
||||
title: Headline
|
||||
required: true
|
||||
description: This is the headline for an accordion.
|
||||
body:
|
||||
title: Body
|
||||
required: true
|
||||
description: This is the body for an accordion.
|
||||
libraryOverrides:
|
||||
dependencies:
|
||||
- core/drupal
|
||||
- core/once
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";.ib-accordion__item{margin:10px 0;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.ib-accordion__headline{background-color:#efefef;padding:20px;cursor:pointer;display:flex;align-items:center}.ib-accordion__headline h1,.ib-accordion__headline h2,.ib-accordion__headline h3,.ib-accordion__headline h4,.ib-accordion__headline h5,.ib-accordion__headline h6{font-size:18px!important;margin:0!important;color:#3272b3;--bs-heading-color:#3272b3}.ib-accordion__headline::before{display:flex;float:left;content:"+";font-size:30px;font-weight:700;justify-content:center;align-items:center;background-color:var(--site-primary);border-radius:100%;width:30px;height:30px;color:#fff;margin-right:10px}.ib-accordion__body{padding:0 20px;max-height:0;overflow:hidden;will-change:max-height;transition:.25s ease-out;align-items:center}.ib-accordion__body>:first-child{margin:20px 0}.ib-accordion__active .ib-accordion__headline::before{content:"−"}
|
||||
@@ -0,0 +1,38 @@
|
||||
(function (Drupal, once) {
|
||||
Drupal.behaviors.accordion = {
|
||||
attach(context) {
|
||||
const accordions = once('accordion', '.ib-accordion__item', context);
|
||||
if (!accordions) {
|
||||
return;
|
||||
}
|
||||
|
||||
const openAccordion = (accordion) => {
|
||||
const content = accordion.querySelector(".ib-accordion__body");
|
||||
accordion.classList.add("ib-accordion__active");
|
||||
content.style.maxHeight = content.scrollHeight + "px";
|
||||
content.setAttribute('aria-expanded', true);
|
||||
}
|
||||
|
||||
const closeAccordion = (accordion) => {
|
||||
const content = accordion.querySelector(".ib-accordion__body");
|
||||
accordion.classList.remove("ib-accordion__active");
|
||||
content.style.maxHeight = null;
|
||||
content.setAttribute('aria-expanded', false)
|
||||
}
|
||||
|
||||
accordions.forEach((accordion) => {
|
||||
const headline = accordion.querySelector(".ib-accordion__headline");
|
||||
const content = accordion.querySelector(".ib-accordion__body");
|
||||
|
||||
headline.onclick = () => {
|
||||
if (content.style.maxHeight) {
|
||||
closeAccordion(accordion);
|
||||
} else {
|
||||
accordions.forEach((accordion) => closeAccordion(accordion));
|
||||
openAccordion(accordion);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
}(Drupal, once));
|
||||
@@ -1,14 +1,14 @@
|
||||
{% set classes = [
|
||||
'accordion',
|
||||
'ib-accordion__item',
|
||||
'ib-accordion__' ~ type|clean_class,
|
||||
] %}
|
||||
|
||||
<div class="accordion">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
{% block accordion_title %}{% endblock %}
|
||||
</h2>
|
||||
{% set ariaLabel = 'accordion-' ~ random(0, 10000) %}
|
||||
<div class="{{ classes|join(" ") }}">
|
||||
<div class="ib-accordion__headline">
|
||||
{% block headline %}{% endblock %}
|
||||
</div>
|
||||
<div class="accordion-body">
|
||||
{% block accordion_content %}{% endblock %}
|
||||
<div class="ib-accordion__body" aria-labelledby="{{ ariaLabel }}" aria-expanded="false">
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Ping Pong
|
||||
props:
|
||||
type: object
|
||||
properties:
|
||||
mediaAlign:
|
||||
type: string
|
||||
title: Media Alignment
|
||||
description: 'Which side to put media on.'
|
||||
layout:
|
||||
type: string
|
||||
title: Layout
|
||||
description: 'The layout widths'
|
||||
enum: ['50-50', '33-66', '66-33', '25-75', '75-25']
|
||||
bgColor:
|
||||
type: string
|
||||
title: Color
|
||||
description: 'The background color.'
|
||||
slots:
|
||||
headline:
|
||||
title: Headline
|
||||
description: This is the headline for the text block.
|
||||
body:
|
||||
title: Body
|
||||
description: This is the body for the text block.
|
||||
cta:
|
||||
title: CTA
|
||||
description: The CTA link.
|
||||
media:
|
||||
title: Media
|
||||
description: The media item(s).
|
||||
|
||||
libraryOverrides:
|
||||
css:
|
||||
theme:
|
||||
ping-pong.css: { }
|
||||
js:
|
||||
ping-pong.js: { }
|
||||
dependencies:
|
||||
- core/drupal
|
||||
- core/once
|
||||
- dchadwick/swiper
|
||||
116
web/themes/custom/dchadwick/components/ping-pong/ping-pong.css
Normal file
116
web/themes/custom/dchadwick/components/ping-pong/ping-pong.css
Normal file
@@ -0,0 +1,116 @@
|
||||
.swiper {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.ping-pong-wrapper {
|
||||
/* max-height: 600px; */
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ping-pong {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ping-pong__info {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
color: var(--site-platinum, #fff);
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.ping-pong__info-text p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.ping-pong__info-text {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.ping-pong__info-inner {
|
||||
width: 65%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
.ping-pong__info-inner {
|
||||
width: 100%;
|
||||
padding: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.ping-pong__info h2 {
|
||||
font-size: 3rem;
|
||||
color: var(--site-white, #fff);
|
||||
margin: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.ping-pong.right {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
.ping-pong > div {
|
||||
flex: 1;
|
||||
max-width: 50%;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
.ping-pong > div {
|
||||
flex: 1 0 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.field--name-field-ping-pong-cta a {
|
||||
background: var(--site-secondary, #fff);
|
||||
padding: 10px 20px;
|
||||
border-radius: 10px;
|
||||
transition: background .5s ease;
|
||||
cursor: pointer;
|
||||
color: var(--site-white);
|
||||
}
|
||||
|
||||
.field--name-field-ping-pong-cta a:hover {
|
||||
background: white;
|
||||
}
|
||||
|
||||
/** slider styles */
|
||||
.ping-pong .swiper-slide img {
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
/*.ping-pong .slide.active img { */
|
||||
/* display: block; */
|
||||
/* opacity: 1; */
|
||||
/* visibility: visible; */
|
||||
/* transition: all .5s ease-in-out; */
|
||||
/*} */
|
||||
|
||||
/*.ping-pong .slide.hide img { */
|
||||
/* opacity: 0; */
|
||||
/* visibility: hidden; */
|
||||
/* transition: all .5s ease-in-out; */
|
||||
/*} */
|
||||
|
||||
/*.ping-pong .slide img { */
|
||||
/* display: none; */
|
||||
/* visibility: hidden; */
|
||||
/* opacity: 0; */
|
||||
/* transition: all .5s ease-in-out; */
|
||||
/*} */
|
||||
|
||||
/*.ping-pong ul.slides { */
|
||||
/* list-style-type: none; */
|
||||
/* padding: 0; */
|
||||
/* margin: 0; */
|
||||
/* max-height: 100%; */
|
||||
/*} */
|
||||
@@ -0,0 +1,40 @@
|
||||
{#
|
||||
* Component variables
|
||||
*
|
||||
* props:
|
||||
* layout
|
||||
* media_alignment
|
||||
* background_color
|
||||
*
|
||||
* slots
|
||||
* headline
|
||||
* body
|
||||
* cta
|
||||
* media
|
||||
*
|
||||
#}
|
||||
{% set classes = [
|
||||
'ping-pong',
|
||||
mediaAlign|clean_class
|
||||
] %}
|
||||
{{ title_prefix }}
|
||||
{{ title_suffix }}
|
||||
<div {{ attributes.addClass(classes) }} style="background-color: {{ bgColor }}">
|
||||
<div class="ping-pong__media">
|
||||
{% block media %}{% endblock %}
|
||||
</div>
|
||||
<div class="ping-pong__info">
|
||||
<div class="ping-pong__info-inner">
|
||||
<div class="ping-pong__info-headline">
|
||||
{% block headline %}{% endblock %}
|
||||
</div>
|
||||
<div class="ping-pong__info-text">
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
<div class="ping-pong__info-cta btn-primary">
|
||||
{% block cta %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
(function (Drupal, once) {
|
||||
Drupal.behaviors.pingPongSlider = {
|
||||
|
||||
attach: function (context, settings) {
|
||||
let sliders = once('pingPongSlider', '.swiper', context);
|
||||
sliders.forEach((slider) => {
|
||||
const swiper = new Swiper(slider, {
|
||||
// Optional parameters
|
||||
loop: true,
|
||||
autoplay: {
|
||||
delay: 5000,
|
||||
},
|
||||
|
||||
// If we need pagination
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
},
|
||||
|
||||
// Navigation arrows
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
},
|
||||
|
||||
// And if we need scrollbar
|
||||
scrollbar: {
|
||||
el: '.swiper-scrollbar',
|
||||
},
|
||||
});
|
||||
// // get the slides
|
||||
// let slides = slider.querySelectorAll('.slide');
|
||||
// slides[0].classList.add("active");
|
||||
// if (slides.length <= 1) {
|
||||
// return;
|
||||
// }
|
||||
// changeSlide(slider);
|
||||
});
|
||||
|
||||
// function changeSlide(sliderDiv, loop = 1) {
|
||||
// setTimeout(() => {
|
||||
// let slideCount = sliderDiv.querySelectorAll('.slide').length;
|
||||
// let activeSlide = sliderDiv.querySelector('.slide.active');
|
||||
// let nextSlide = activeSlide.nextElementSibling;
|
||||
// if (loop == slideCount) {
|
||||
// nextSlide = sliderDiv.querySelectorAll('.slide')[0];
|
||||
// return;
|
||||
// // get the first slide
|
||||
// }
|
||||
// else {
|
||||
// loop++;
|
||||
// activeSlide.classList.toggle('active');
|
||||
// nextSlide.classList.toggle('active');
|
||||
// changeSlide(sliderDiv, loop);
|
||||
// }
|
||||
// }, 10000);
|
||||
// }
|
||||
}
|
||||
|
||||
};
|
||||
})(Drupal, once);
|
||||
|
||||
@@ -44,3 +44,10 @@ tabbed-content:
|
||||
dependencies:
|
||||
- core/drupal
|
||||
- core/once
|
||||
|
||||
swiper:
|
||||
css:
|
||||
theme:
|
||||
libraries/swiper-bundle.min.css: { minified: true }
|
||||
js:
|
||||
libraries/swiper-bundle.min.js: { minified: true }
|
||||
|
||||
13
web/themes/custom/dchadwick/libraries/swiper/swiper-bundle.min.css
vendored
Normal file
13
web/themes/custom/dchadwick/libraries/swiper/swiper-bundle.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
14
web/themes/custom/dchadwick/libraries/swiper/swiper-bundle.min.js
vendored
Normal file
14
web/themes/custom/dchadwick/libraries/swiper/swiper-bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,45 @@
|
||||
{#
|
||||
* Component variables
|
||||
*
|
||||
* props:
|
||||
* layout
|
||||
* mediaAlign
|
||||
* bgColor
|
||||
*
|
||||
* slots
|
||||
* headline
|
||||
* body
|
||||
* cta
|
||||
* media
|
||||
*
|
||||
#}
|
||||
{% set align = content.field_ping_pong_media_alignment.0['#markup'] %}
|
||||
{% set bgColor = content.field_ping_pong_background_color.0['#markup']|default('#fff') %}
|
||||
<div {{ attributes.addClass('ping-pong-wrapper') }}>
|
||||
{{ title_prefix }}
|
||||
{{ title_suffix }}
|
||||
|
||||
{% embed 'dchadwick:ping-pong' with {
|
||||
mediaAlign: align,
|
||||
bgColor: bgColor,
|
||||
}%}
|
||||
|
||||
{% block headline %}
|
||||
<h2>{{ label }}</h2>
|
||||
{% endblock%}
|
||||
|
||||
{% block body %}
|
||||
{{ content.field_ping_pong_body }}
|
||||
{% endblock %}
|
||||
|
||||
{% block cta %}
|
||||
{{ content.field_ping_pong_cta }}
|
||||
{% endblock %}
|
||||
|
||||
{% block media %}
|
||||
{{ content.field_ping_pong_media_items }}
|
||||
{% endblock %}
|
||||
|
||||
{% endembed %}
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,57 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override 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()
|
||||
*/
|
||||
#}
|
||||
{%
|
||||
set title_classes = [
|
||||
label_display == 'visually_hidden' ? 'visually-hidden',
|
||||
]
|
||||
%}
|
||||
<div{{ attributes.addClass('swiper') }}>
|
||||
<div class="swiper-wrapper">
|
||||
{% for item in items %}
|
||||
<div {{ item.attributes.addClass('swiper-slide') }}>{{ item.content }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- If we need pagination -->
|
||||
<div class="swiper-pagination"></div>
|
||||
<!-- If we need navigation buttons -->
|
||||
<div class="swiper-button-prev"></div>
|
||||
<div class="swiper-button-next"></div>
|
||||
<!-- If we need scrollbar -->
|
||||
<div class="swiper-scrollbar"></div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user