Skip to content

Commit

Permalink
Add inline card style
Browse files Browse the repository at this point in the history
  • Loading branch information
rijkvanzanten committed Aug 9, 2023
1 parent 926573b commit f9b3440
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions components/Base/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface BaseCardProps {
to?: string;
layout?: 'vertical' | 'horizontal';
aspect?: '16-9' | '1-1';
imageSize?: 'icon' | 'cover';
imageSize?: 'inline' | 'icon' | 'cover';
}
withDefaults(defineProps<BaseCardProps>(), {
Expand All @@ -18,12 +18,15 @@ withDefaults(defineProps<BaseCardProps>(), {

<template>
<NuxtLink :to="to" class="base-card" :class="`direction-${layout}`">
<div class="image" :class="[`aspect-${aspect}`, `size-${imageSize}`]">
<BaseDirectusImage v-if="image" :uuid="image" :alt="title" />
<div v-if="image && imageSize !== 'inline'" class="image" :class="[`aspect-${aspect}`, `size-${imageSize}`]">
<BaseDirectusImage :uuid="image" :alt="title" />
</div>

<div class="content">
<h3 class="heading">{{ title }}</h3>
<h3 class="heading">
<BaseDirectusImage v-if="image && imageSize === 'inline'" :uuid="image" :alt="title" />
{{ title }}
</h3>

<p v-if="description" class="description">
{{ description }}
Expand Down Expand Up @@ -84,6 +87,18 @@ withDefaults(defineProps<BaseCardProps>(), {
font-size: var(--font-size-base);
line-height: var(--line-height-base);
font-weight: 600;
display: flex;
> img {
width: var(--space-6);
height: var(--space-6);
object-fit: contain;
margin-inline-end: var(--space-2);
}
&:has(img) {
margin-block-end: var(--space-3);
}
}
.description {
Expand Down
2 changes: 1 addition & 1 deletion types/schema/blocks/block-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface BlockCard {
sort: number;
title: string;
description: string | null;
image_size: 'icon' | 'cover' | null;
image_size: 'inline' | 'icon' | 'cover' | null;
image: string | File | null;
type: 'pages' | 'resources' | 'external' | null;
external_url: string | null;
Expand Down

0 comments on commit f9b3440

Please sign in to comment.