Skip to content

Commit

Permalink
More spacing on larger screens and add button group
Browse files Browse the repository at this point in the history
  • Loading branch information
LZylstra committed Jan 14, 2025
1 parent e9e8c98 commit db76c10
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
15 changes: 15 additions & 0 deletions components/Block/Carousel/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ onMounted(async () => {
&.slide--selected > * {
opacity: 1;
transform: scale(1.2);
margin-left: var(--space-4);
margin-right: var(--space-4);
}
}
&__controls {
Expand Down Expand Up @@ -133,4 +135,17 @@ onMounted(async () => {
}
}
}
@media (min-width: 1200px) {
.embla__slide {
padding-left: calc(var(--slide-spacing) + 20px);
}
.embla__slide.slide--selected {
> * {
margin-left: var(--space-8);
margin-right: var(--space-8);
}
}
}
</style>
46 changes: 18 additions & 28 deletions components/Block/Carousel/CarouselCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,13 @@ const { data: cardData } = useAsyncData(`carousel-card-${props.uuid}`, () =>
'external_url',
'button_text',
'description',
{ block_button_group: ['id', 'alignment'] },
{ page: ['permalink'] },
{ resource: ['slug'] },
],
}),
),
);
const buttonHref = computed(() => {
if (cardData.value?.external_url) {
return cardData.value.external_url;
}
if (cardData.value?.page?.permalink) {
return cardData.value.page.permalink;
}
if (cardData.value?.resource?.slug) {
return `/resource/${cardData.value.resource.slug}`;
}
return '#';
});
</script>

<template>
Expand All @@ -50,16 +35,11 @@ const buttonHref = computed(() => {
<div v-show="props.isFocused" class="card-content">
<h2 class="title">{{ cardData?.title }}</h2>
<p v-if="cardData?.description" class="description">{{ cardData?.description }}</p>
<BaseButton
v-show="props.isFocused"
:href="buttonHref"
:label="cardData?.button_text"
color="secondary"
outline
class="custom-button"
size="medium"
icon="arrow_forward"
icon-position="right"
<BlockButtonGroup
v-if="cardData?.block_button_group"
class="custom-button-group"
:uuid="cardData?.block_button_group.id as string"
:align="cardData.block_button_group.alignment"
/>
</div>
</Transition>
Expand Down Expand Up @@ -103,8 +83,18 @@ const buttonHref = computed(() => {
max-width: 80%;
}
}
.custom-button {
margin-top: var(--space-3);
.custom-button-group {
display: flex;
flex-wrap: nowrap !important;
justify-content: center;
align-items: center;
gap: var(--space-4);
}
.custom-button-group :deep(.button-group) {
display: flex;
flex-wrap: nowrap !important;
justify-content: center;
align-items: center;
}
}
.fade-enter-active,
Expand Down
2 changes: 2 additions & 0 deletions types/schema/blocks/block-carousel-cards.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Resource } from '../content';
import type { Page } from '../routes';
import type { File } from '../system';
import type { BlockButtonGroup } from './block-button-group';

export interface BlockCarouselCards {
id: string;
Expand All @@ -12,4 +13,5 @@ export interface BlockCarouselCards {
page?: string | Page | null;
resource?: string | Resource | null;
button_text?: string;
block_button_group?: string | BlockButtonGroup | null;
}

0 comments on commit db76c10

Please sign in to comment.