Skip to content

Commit 532fa2f

Browse files
LZylstraLindsey Zylstra
andauthored
Updates to Masonry Grid, Carousel, Wall of Love (#177)
* MasonryGrid hover color sync, carousel description and button style, wall of love style * PR updates (quotes styling, if for carousel description) * imports should go before props --------- Co-authored-by: Lindsey Zylstra <[email protected]>
1 parent 995b044 commit 532fa2f

File tree

6 files changed

+173
-49
lines changed

6 files changed

+173
-49
lines changed

components/Block/Carousel/CarouselCard.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const { data: cardData } = useAsyncData(`carousel-card-${props.uuid}`, () =>
1818
'image',
1919
'external_url',
2020
'button_text',
21+
'description',
2122
{ page: ['permalink'] },
2223
{ resource: ['slug'] },
2324
],
@@ -46,14 +47,15 @@ const buttonHref = computed(() => {
4647
<div :class="['carousel-card-content', { 'carousel-card--focused': props.isFocused }]">
4748
<BaseDirectusImage v-if="cardData?.image" :uuid="cardData?.image as string" :alt="cardData?.title ?? ''" />
4849
<Transition name="fade">
49-
<div v-show="props.isFocused">
50+
<div v-show="props.isFocused" class="card-content">
5051
<h2 class="title">{{ cardData?.title }}</h2>
52+
<p v-if="cardData?.description" class="description">{{ cardData?.description }}</p>
5153
<BaseButton
5254
v-show="props.isFocused"
5355
:href="buttonHref"
5456
:label="cardData?.button_text"
5557
color="secondary"
56-
ghost
58+
outline
5759
class="custom-button"
5860
size="medium"
5961
icon="arrow_forward"
@@ -75,6 +77,11 @@ const buttonHref = computed(() => {
7577
border-radius: var(--rounded-lg);
7678
margin-bottom: var(--space-3);
7779
}
80+
.card-content {
81+
display: flex;
82+
flex-direction: column;
83+
align-items: center;
84+
}
7885
h2 {
7986
font-style: normal;
8087
font-family: var(--family-display);
@@ -87,9 +94,15 @@ const buttonHref = computed(() => {
8794
max-width: var(--space-80);
8895
word-wrap: break-word;
8996
line-height: var(--line-height-2xl);
90-
min-height: calc(var(--line-height-2xl) * 2);
97+
9198
overflow-wrap: break-word;
9299
}
100+
.description {
101+
min-height: calc(var(--line-height-2xl) * 1.5);
102+
@media (max-width: 768px) {
103+
max-width: 80%;
104+
}
105+
}
93106
.custom-button {
94107
margin-top: var(--space-3);
95108
}

components/Block/MasonryGrid/MasonryGridCard.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,22 @@ const isExternal = computed(() => !!cardData.value?.external_url);
8080
margin: 0 1% 1% 0;
8181
}
8282
83+
&:hover {
84+
img {
85+
filter: grayscale(0%) opacity(100%);
86+
}
87+
88+
.title a {
89+
color: var(--primary-500);
90+
}
91+
}
92+
8393
img {
8494
width: 100%;
8595
height: 100%;
8696
object-fit: cover;
8797
filter: grayscale(100%) opacity(40%);
8898
transition: filter 0.3s ease-in-out;
89-
90-
&:hover {
91-
filter: grayscale(0%) opacity(100%);
92-
}
9399
}
94100
95101
.title {
@@ -107,10 +113,6 @@ const isExternal = computed(() => !!cardData.value?.external_url);
107113
color: inherit;
108114
text-decoration: none;
109115
transition: color 0.3s ease;
110-
111-
&:hover {
112-
color: var(--primary-500);
113-
}
114116
}
115117
}
116118

components/Block/WallOfLove/Testimonial.vue

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script setup lang="ts">
2-
const props = defineProps<{ testimonialData: Testimonial }>();
3-
42
import placeholderAvatar from '~/assets/svg/placeholder-avatar.svg';
53
import starIcon from '~/assets/svg/star.svg';
6-
import type { Testimonial } from '~/types/schema/content';
4+
import type { Testimonial } from '~/types/schema';
5+
6+
const props = defineProps<{ testimonialData: Testimonial }>();
77
88
const {
99
public: { directusUrl },
@@ -55,13 +55,13 @@ const logoImageUrl = computed(() => {
5555
border-radius: var(--rounded-xl);
5656
border: 1px solid var(--gray-200);
5757
background: var(--background);
58-
display: flex;
59-
min-width: 358px;
60-
min-height: 330px;
6158
padding: var(--space-8);
62-
color: var(--foreground);
59+
display: flex;
6360
flex-direction: column;
61+
color: var(--foreground);
6462
gap: var(--space-8);
63+
height: 100%;
64+
box-sizing: border-box;
6565
6666
@media (max-width: 768px) {
6767
padding: var(--space-6);
@@ -113,20 +113,42 @@ const logoImageUrl = computed(() => {
113113
114114
.quote {
115115
margin-bottom: var(--space-3);
116-
font-style: italic;
117116
flex-grow: 1;
118117
119-
:deep(> *) {
118+
:deep(> *:not(p)) {
119+
position: relative;
120+
display: inline;
120121
quotes: auto;
122+
font-family: var(--family-display) !important;
121123
122124
&::before {
123125
content: open-quote;
124-
position: absolute;
125-
translate: -0.7ch 0;
126+
margin-right: 0.2ch;
126127
}
127128
128129
&::after {
129130
content: close-quote;
131+
margin-left: 0.2ch;
132+
}
133+
}
134+
135+
:deep(p) {
136+
position: relative;
137+
display: inline;
138+
font-family: var(--family-display) !important;
139+
140+
&[data-no-quotes='false'] {
141+
quotes: auto;
142+
143+
&::before {
144+
content: open-quote;
145+
margin-right: 0.2ch;
146+
}
147+
148+
&::after {
149+
content: close-quote;
150+
margin-left: 0.2ch;
151+
}
130152
}
131153
}
132154
}
@@ -140,24 +162,15 @@ const logoImageUrl = computed(() => {
140162
141163
.company-logo {
142164
max-height: 40px;
143-
max-width: 150px;
165+
max-width: 120px;
144166
width: auto;
145167
146-
@media (max-width: 768px) {
147-
max-width: 150px;
148-
}
149-
150168
@media (max-width: 480px) {
169+
max-height: 30px;
151170
max-width: 100px;
152171
}
153172
}
154173
155-
.logo-placeholder {
156-
width: 40px;
157-
height: 40px;
158-
border-radius: var(--rounded);
159-
}
160-
161174
.stars {
162175
display: flex;
163176
gap: var(--space-1);

components/Block/WallOfLove/WallOfLove.vue

Lines changed: 110 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const { data: block } = useAsyncData(`wall-of-love-${props.uuid}`, () =>
1111
'heading',
1212
{
1313
testimonials: [
14-
{ testimonials_id: ['id', 'company', 'name', 'role', 'quote', 'logo', 'avatar', 'avatar_url'] },
14+
{
15+
testimonials_id: ['id', 'company', 'name', 'role', 'quote', 'logo', 'avatar', 'avatar_url', 'card_width'],
16+
},
1517
],
1618
},
1719
],
@@ -27,18 +29,30 @@ const displayedTestimonials = computed(() => {
2729
2830
const toggleShowAll = () => {
2931
showAll.value = !showAll.value;
32+
33+
if (!showAll.value) {
34+
const wallOfLoveElement = document.querySelector('.wall-of-love');
35+
36+
if (wallOfLoveElement) {
37+
wallOfLoveElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
38+
}
39+
}
3040
};
3141
</script>
3242

3343
<template>
3444
<div v-if="block" class="wall-of-love">
3545
<h2 class="wall-heading">{{ block.heading }}</h2>
36-
<div class="testimonial-container">
46+
<div class="testimonial-container" :class="{ expanded: showAll }">
3747
<BlockWallOfLoveTestimonial
3848
v-for="testimonial in displayedTestimonials"
3949
:key="testimonial.testimonials_id.id"
4050
:testimonial-data="testimonial.testimonials_id"
41-
class="testimonial-item"
51+
:class="[
52+
'testimonial-item',
53+
`size-${testimonial.testimonials_id.card_width || 'flexible'}`,
54+
testimonial.testimonials_id.quote.length > 400 ? 'long-quote' : '',
55+
]"
4256
/>
4357
<!-- Fading effect -->
4458
<div v-if="!showAll && block.testimonials && block.testimonials.length > 6" class="fade-out"></div>
@@ -68,7 +82,6 @@ const toggleShowAll = () => {
6882
.wall-heading {
6983
color: var(--gray-500);
7084
font-size: var(--font-size-2xl);
71-
font-style: normal;
7285
font-weight: 600;
7386
line-height: var(--line-height-2xl);
7487
}
@@ -81,37 +94,118 @@ const toggleShowAll = () => {
8194
justify-content: center;
8295
width: 100%;
8396
position: relative;
97+
align-items: stretch;
98+
max-height: calc(2 * 300px + var(--space-4) / 2);
99+
overflow: hidden;
100+
transition: max-height 0.3s ease;
101+
102+
&.expanded {
103+
max-height: none;
104+
overflow: visible;
105+
}
106+
107+
.fade-out {
108+
position: absolute;
109+
bottom: 0;
110+
left: 0;
111+
width: 100%;
112+
height: 100px; /* Height of the fade effect */
113+
background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.9));
114+
pointer-events: none;
115+
z-index: 1;
116+
}
84117
}
85118
86119
.testimonial-item {
87-
flex: 1 1 calc(33.333% - 16px);
120+
display: flex;
88121
min-width: 300px;
122+
flex-direction: column;
123+
justify-content: space-between;
124+
width: 100%;
125+
height: auto; /* Ensure cards maintain their height */
89126
box-sizing: border-box;
127+
padding: var(--space-8); /* Restore proper padding inside the cards */
128+
background: var(--background); /* Ensure cards have background */
129+
border: 1px solid var(--gray-200);
130+
border-radius: var(--rounded-xl);
131+
132+
& p {
133+
font-family: var(--family-display) !important;
134+
}
135+
136+
&.size-small {
137+
flex: 1 1 calc(20% - 16px);
138+
}
139+
140+
&.size-medium {
141+
flex: 1 1 calc(30% - 16px);
142+
}
143+
144+
&.size-large {
145+
flex: 1 1 calc(40% - 16px);
146+
}
147+
148+
&.size-flexible {
149+
flex: 1 1 calc(33.333% - 16px);
150+
}
151+
152+
&.long-quote {
153+
flex: 1 1 calc(60% - 16px);
154+
}
155+
156+
.footer {
157+
display: flex;
158+
align-items: center;
159+
justify-content: space-between;
160+
gap: var(--space-2);
161+
margin-top: var(--space-4);
162+
163+
.company-logo {
164+
max-height: 40px;
165+
max-width: 120px;
166+
width: auto;
167+
168+
@media (max-width: 480px) {
169+
max-height: 30px;
170+
max-width: 100px;
171+
}
172+
}
173+
174+
.stars {
175+
display: flex;
176+
gap: var(--space-1);
177+
178+
.star-icon {
179+
width: 16px;
180+
height: 16px;
181+
182+
@media (max-width: 480px) {
183+
width: 14px;
184+
height: 14px;
185+
}
186+
}
187+
}
188+
}
90189
}
91190
191+
/* Tablet adjustments */
92192
@media (max-width: 768px) {
93193
.testimonial-item {
94194
flex: 1 1 calc(50% - 16px);
95195
}
196+
197+
.testimonial-item.long-quote {
198+
flex: 1 1 calc(100% - 16px);
199+
}
96200
}
97201
202+
/* Mobile adjustments */
98203
@media (max-width: 480px) {
99204
.testimonial-item {
100205
flex: 1 1 100%;
101206
}
102207
}
103208
104-
.fade-out {
105-
position: absolute;
106-
bottom: 0;
107-
left: 0;
108-
width: 100%;
109-
height: 450px;
110-
background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.9));
111-
pointer-events: none;
112-
z-index: 1;
113-
}
114-
115209
.see-more-button {
116210
margin: var(--space-4) auto;
117211
align-self: center;

types/schema/blocks/block-carousel-cards.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { File } from '../system';
55
export interface BlockCarouselCards {
66
id: string;
77
title: string;
8+
description: string;
89
image?: string | File | null;
910
type?: 'pages' | 'resources' | 'external' | null;
1011
external_url?: string | null;

types/schema/content/testimonials.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export interface Testimonial {
88
logo: string | File | null;
99
avatar: string | File | null;
1010
avatar_url: string | null;
11+
card_width: string | null;
1112
}

0 commit comments

Comments
 (0)