Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBD Fractal Components #505

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8d35f6e
[#187227450] create new card block component
Apr 2, 2024
4ef3be3
[#187227450] remove static min-heights from card content
Apr 3, 2024
36fdef8
[#187227450] create new carousel block component
Apr 3, 2024
7c8aff8
[#187227450] new button variations and html button option added
Apr 3, 2024
12ed686
[#187227450] create new quicklinks block component
Apr 3, 2024
03b168f
[#187227450] create master brand nav block component
Apr 4, 2024
43d76c6
[#187227450] ensure elements exist before executing js code
Apr 4, 2024
90541bd
Merge branch 'main' into feature-187227450
Apr 9, 2024
842f0ed
[#187227450] rename label-tag variant
Apr 9, 2024
0a240a9
[#187227450] rework master brand nav block to correct component
Apr 9, 2024
4ba823e
[#187227450] rework navigation button variant to requested component
Apr 10, 2024
586bc4f
[#187227450] remove swiper library and implement simple custom carous…
Apr 10, 2024
6b2d3ec
[#187227450] fix remaining linting errors
Apr 10, 2024
5c8b4c1
[#187227450] various minor fixes and cleanup
Apr 16, 2024
57be583
add default focus styles (accessibility requirement)
methodog Apr 17, 2024
23e7ca1
carousel: fix keyboard & screenreader accessibility; add swipe gestur…
methodog Apr 17, 2024
c7b5498
supply proper full image srcset, needed for testing responsive img tag
methodog Apr 17, 2024
09a1858
[#187227450] remove quicklinks button variant
Apr 18, 2024
efc3e30
[#187227450] add quicklinks button styles to component and remove pre…
Apr 18, 2024
7736a69
[#187227450] update image src sizes to correctly correspond with brea…
Apr 18, 2024
ccc67b6
[#187227450] remove references to removed scripts
Apr 18, 2024
965a131
cleanup after moving these style into Quicklink component
methodog Apr 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16,800 changes: 2,901 additions & 13,899 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"browser-cookies": "^1.2.0",
"clamp-js": "^0.7.0",
"openseadragon": "^3.x",
"surge": "^0.23.1"
"surge": "^0.23.1",
"swiper": "^11.1.0"
},
"scripts": {
"dev": "NODE_ENV=development concurrently 'node ./fractal-server' 'npm run build-dev:webpack'",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/scripts/vam-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import oicInit from '../../components/blocks/object-image-overlay/_object-image-
import contentWarningsInit from '../../components/blocks/object-card/_object-card';

require('../../components/services/imageload/_imageload');
require('../../components/units/button/_button');
require('../../components/blocks/accordion/_accordion');
require('../../components/blocks/background-video/_background-video');
require('../../components/groups/block-grid/_grid-reveal-more');
Expand All @@ -24,6 +25,9 @@ require('../../components/blocks/toggle-nav/_toggle-nav');
require('../../components/blocks/video-thumbnail/_video-thumbnail');
require('../../components/blocks/video-trailer/_video-trailer');
require('../../components/blocks/events-featured/_events-featured');
require('../../components/blocks/quicklinks/_quicklinks');
require('../../components/blocks/carousel/_carousel');
require('../../components/blocks/master-brand-nav/_master-brand-nav');
require('../../components/groups/facet-box-modal/_facet-box-modal');
require('../../components/groups/image-overlay/_image-overlay');
require('../../components/groups/story-box-container/_story-box-container');
Expand Down
6 changes: 6 additions & 0 deletions src/assets/styles/vam-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
@use "../../components/blocks/associated-contexts/associated-contexts";
@use "../../components/blocks/background-image/background-image";
@use "../../components/blocks/background-video/background-video";
@use "../../components/blocks/card/card";
@use "../../components/blocks/carousel/swiper-bundle.css";
methodog marked this conversation as resolved.
Show resolved Hide resolved
@use "../../components/blocks/carousel/carousel";
@use "../../components/blocks/collection-card/collection-card";
@use "../../components/blocks/context-page-title/context-page-title";
@use "../../components/blocks/cookie-banner/cookie-banner";
Expand All @@ -29,6 +32,7 @@
@use "../../components/blocks/image-row/image-row";
@use "../../components/blocks/input-select/input-select";
@use "../../components/blocks/object-image-overlay/object-image-overlay";
@use "../../components/blocks/master-brand-nav/master-brand-nav";
@use "../../components/blocks/membership-upsell/membership-upsell";
@use "../../components/blocks/newsletter-signup/newsletter-signup";
@use "../../components/blocks/object-card/object-card";
Expand All @@ -37,6 +41,8 @@
@use "../../components/blocks/pagination/pagination";
@use "../../components/blocks/programme-page-tout/programme-page-tout";
@use "../../components/blocks/promo/promo";
@use "../../components/blocks/quicklinks/quicklinks";
@use "../../components/blocks/quicklinks/quicklinks-preview";
@use "../../components/blocks/review/review";
@use "../../components/blocks/section-header/section-header";
@use "../../components/blocks/search-form/search-form";
Expand Down
124 changes: 124 additions & 0 deletions src/components/blocks/card/_card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
@use "../../mixins";
@use "../../base";
@use "sass:color";

.b-card {
color: base.sitecolors-siteColor("vam-black");
margin-bottom: 32px;
overflow: hidden;
padding: 0 10px;
position: relative;
width: 100%;

@include mixins.breakpoints-bpMinMedium {
width: 50%;
}

@include mixins.breakpoints-bpMinLarge {
width: 33.333%;
}

&__link {
display: block;
margin-bottom: 10px;
position: relative;

&:hover h2,
&:focus h2 {
text-decoration: underline;
}

@include mixins.breakpoints-bpMinSmall {
display: flex;
flex-direction: row;
align-items: stretch;
}

@include mixins.breakpoints-bpMinMedium {
display: block;
}
}

&__media {
overflow: hidden;
padding-top: 66.67%;
position: relative;
margin-bottom: 16px;

@include mixins.breakpoints-bpMinSmall {
margin-bottom: 0;
padding-top: calc(66.67% / 2);
width: 50%;
}

@include mixins.breakpoints-bpMinMedium {
margin-bottom: 16px;
padding-top: 66.67%;
width: 100%;
}

&::after {
background-image:
linear-gradient(
rgba(base.sitecolors-siteColor("vam-black"), 0.35),
rgba(base.sitecolors-siteColor("vam-black"), 0)
);
content: "";
display: block;
height: 100%;
left: 0;
opacity: 0;
position: absolute;
top: 0;
transition: opacity 0.35s ease;
width: 100%;
z-index: 0;

.b-event-teaser__link:hover &,
.b-event-teaser__link:focus & {
opacity: 1;
}
}
}

&__media-image {
height: 100%;
left: 0;
object-fit: cover;
position: absolute;
top: 0;
width: 100%;
}

&__content {
display: flex;
flex-direction: column;
border-bottom: 1px solid base.sitecolors-siteColor("vam-grey-7");

@include mixins.breakpoints-bpMinSmall {
margin-left: 24px;
width: calc(50% - 24px);
}

@include mixins.breakpoints-bpMinMedium {
margin-left: 0;
width: 100%;
}
}

&__title {
@include base.typography-typeSetting(5, "bold");

margin-bottom: 8px;
}

&__buttons {
margin-top: auto;
margin-left: auto;
padding: 30px 0 16px;

.u-btn {
margin: 0;
}
}
}
22 changes: 22 additions & 0 deletions src/components/blocks/card/card.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
title: 'Card',
context: {
cardUrl: 'https://www.vam.ac.uk/exhibitions/pink-floyd',
cardTitle: 'The Leman Album: an enhanced facsimile',
cardDescription: 'This 18th-century volume contains Europe\'s earliest dated silk designs – close to 100 astonishingly vibrant drawings on paper.',
cardImage: {
320: 'https://vanda-production-assets.s3.amazonaws.com/2017/03/16/12/27/07/8462b6bc-d141-4808-8af2-cb5caeddfd50/leman_hero.jpg',
640: 'https://vanda-production-assets.s3.amazonaws.com/2017/03/16/12/27/07/8462b6bc-d141-4808-8af2-cb5caeddfd50/leman_hero.jpg',
960: 'https://vanda-production-assets.s3.amazonaws.com/2017/03/16/12/27/07/8462b6bc-d141-4808-8af2-cb5caeddfd50/leman_hero.jpg',
1280: 'https://vanda-production-assets.s3.amazonaws.com/2017/03/16/12/27/07/8462b6bc-d141-4808-8af2-cb5caeddfd50/leman_hero.jpg',
},
},
variants: [
{
name: 'Current project',
context: {
currentProject: true
}
methodog marked this conversation as resolved.
Show resolved Hide resolved
},
]
};
35 changes: 35 additions & 0 deletions src/components/blocks/card/card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div class="b-card{% for m in modifiers %} b-card--{{ m }}{% endfor %}">
<a class="b-card__link" itemprop="url" content="{{ cardUrl }}" href="{{ cardUrl }}">
<div class="b-card__media">
{% if currentProject %}
{%- render "@label-tag--current-project" -%}
methodog marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}
<img alt="{{ cardTitle }}"
class="b-card__media-image"
itemprop="image"
sizes="(max-width: 499px) calc(100vw - 20px),
(min-width: 500px) calc(50vw - 40px),
(min-width: 992px) calc(33vw - 80px)"
methodog marked this conversation as resolved.
Show resolved Hide resolved
srcset="{% for k, img in cardImage %}{{ img }} {{ k }}w{% if loop.last == false %}, {% endif %}{% endfor %}"
src="{{ cardImage[640] }}"
loading="lazy"
/>
</div>

<div class="b-card__content">
<h2 class="b-card__title" itemprop="name" content="{{ eventTitle }}">
{{ cardTitle }}
</h2>

<div itemprop="description" class="b-card__description">
{{ cardDescription }}
</div>

<div class="b-card__buttons">
<div class="u-btn u-btn--micro {% if modifiers and 'dark' in modifiers %}u-btn--outlined-inverse{% else %}u-btn--outlined{% endif %}">
More info
</div>
</div>
</div>
</a>
</div>
16 changes: 16 additions & 0 deletions src/components/blocks/carousel/_carousel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Swiper from 'swiper';
import { EffectFade, Navigation } from 'swiper/modules';

const container = document.querySelector('.b-carousel__swiper');

const swiper = new Swiper({
modules: [EffectFade, Navigation],
loop: true,
effect: "fade",
navigation: {
nextEl: '.b-carousel__next',
prevEl: '.b-carousel__prev',
},
});

swiper.init(container);
Loading