-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Page Builder > Hero Headline Block (#24)
* Merge branch 'types/schema-1.0' into nuxt/pageblocks * update fields and types * delete sample block * page and block base components * catch all route * Add types to Directus SDK * base css * file url utility composable * hero headline * Improve types structure * Add path as key for async data * Cleanup components * Fix type error * Use margin-inline instead of left/right --------- Co-authored-by: rijkvanzanten <[email protected]>
- Loading branch information
1 parent
1555451
commit 93806d1
Showing
28 changed files
with
85 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<template><slot /></template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<script setup lang="ts"> | ||
import { readItem } from '@directus/sdk'; | ||
import { BlockProps } from './types'; | ||
const { $directus } = useNuxtApp(); | ||
const props = defineProps<BlockProps>(); | ||
const { data: block } = useAsyncData(() => | ||
$directus.request( | ||
readItem('block_hero_headline', props.uuid, { | ||
fields: ['heading', 'subheading', { button_group: [{ buttons: ['page', 'external_url', 'variant', 'label'] }] }], | ||
}) | ||
) | ||
); | ||
</script> | ||
|
||
<template> | ||
<div v-if="block" class="hero-headline"> | ||
<BaseHeading size="title" align="center" :content="block.heading" /> | ||
<BaseText align="center" :content="block.subheading" /> | ||
<BaseButtonGroup class="buttons"> | ||
<BaseButton | ||
v-for="(button, idx) in block.button_group?.buttons" | ||
:key="idx" | ||
:href="button.page ?? button.external_url ?? undefined" | ||
:variant="button.variant" | ||
> | ||
{{ button.label }} | ||
</BaseButton> | ||
</BaseButtonGroup> | ||
</div> | ||
</template> | ||
<style scoped> | ||
.hero-headline { | ||
padding-top: var(--space-12); | ||
padding-bottom: var(--space-12); | ||
max-width: 64rem; | ||
margin-inline: auto; | ||
} | ||
.hero-headline > * + * { | ||
margin-top: var(--space-8); | ||
} | ||
.hero-headline .base-text { | ||
margin-inline: auto; | ||
max-width: 48rem; | ||
} | ||
.buttons { | ||
width: 100%; | ||
margin-inline: auto; | ||
display: flex; | ||
justify-content: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ema/content/page/block/block-cardgroup.ts → types/schema/blocks/block-cardgroup.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ema/content/page/block/block-hero-form.ts → types/schema/blocks/block-hero-form.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...content/page/block/block-hero-headline.ts → types/schema/blocks/block-hero-headline.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ma/content/page/block/block-logo-cloud.ts → types/schema/blocks/block-logo-cloud.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...tent/page/block/block-media-full-width.ts → ...s/schema/blocks/block-media-full-width.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...a/content/page/block/block-page-header.ts → types/schema/blocks/block-page-header.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...hema/content/page/block/block-showcase.ts → types/schema/blocks/block-showcase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...ontent/page/component/component-button.ts → types/schema/components/component-button.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...content/page/component/component-media.ts → types/schema/components/component-media.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...content/page/component/component-quote.ts → types/schema/components/component-quote.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
export type * from './block/index.js'; | ||
export type * from './component/index.js'; | ||
export type * from './page-section-block.js'; | ||
export type * from './page-section.js'; | ||
export type * from './page.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters