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

More spacing on larger screens and add button group #179

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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>
50 changes: 22 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 All @@ -81,6 +61,8 @@ const buttonHref = computed(() => {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--space-4);
padding-bottom: var(--space-2);
}
h2 {
font-style: normal;
Expand All @@ -98,13 +80,25 @@ const buttonHref = computed(() => {
overflow-wrap: break-word;
}
.description {
order: 1;
min-height: calc(var(--line-height-2xl) * 1.5);
@media (max-width: 768px) {
max-width: 80%;
}
}
.custom-button {
margin-top: var(--space-3);
.custom-button-group {
order: 2;
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;
}
Loading