From 13b9c23e3b41919bba1696b02401ea1f8b43f68d Mon Sep 17 00:00:00 2001 From: Juri Date: Wed, 5 Feb 2025 16:31:18 +0100 Subject: [PATCH] feat(nx-dev): add quote component for enterprise articles --- nx-dev/ui-markdoc/src/index.ts | 4 ++ .../src/lib/tags/quote.component.tsx | 57 +++++++++++++++++++ .../ui-markdoc/src/lib/tags/quote.schema.ts | 27 +++++++++ 3 files changed, 88 insertions(+) create mode 100644 nx-dev/ui-markdoc/src/lib/tags/quote.component.tsx create mode 100644 nx-dev/ui-markdoc/src/lib/tags/quote.schema.ts diff --git a/nx-dev/ui-markdoc/src/index.ts b/nx-dev/ui-markdoc/src/index.ts index 7f8c228e9f..6356e9484e 100644 --- a/nx-dev/ui-markdoc/src/index.ts +++ b/nx-dev/ui-markdoc/src/index.ts @@ -54,6 +54,8 @@ import { FenceWrapper } from './lib/nodes/fence-wrapper.component'; import { VideoPlayer, videoPlayer } from './lib/tags/video-player.component'; import { TableOfContents } from './lib/tags/table-of-contents.component'; import { tableOfContents } from './lib/tags/table-of-contents.schema'; +import { Quote } from './lib/tags/quote.component'; +import { quote } from './lib/tags/quote.schema'; // TODO fix this export export { GithubRepository } from './lib/tags/github-repository.component'; @@ -84,6 +86,7 @@ export const getMarkdocCustomConfig = ( personas, 'project-details': projectDetails, pill, + quote, 'short-embeds': shortEmbeds, 'short-video': shortVideo, 'side-by-side': sideBySide, @@ -114,6 +117,7 @@ export const getMarkdocCustomConfig = ( Personas, ProjectDetails, Pill, + Quote, ShortEmbeds, ShortVideo, SideBySide, diff --git a/nx-dev/ui-markdoc/src/lib/tags/quote.component.tsx b/nx-dev/ui-markdoc/src/lib/tags/quote.component.tsx new file mode 100644 index 0000000000..c794ac1878 --- /dev/null +++ b/nx-dev/ui-markdoc/src/lib/tags/quote.component.tsx @@ -0,0 +1,57 @@ +import { cx } from '@nx/nx-dev/ui-primitives'; + +export interface QuoteProps { + quote: string; + author: string; + title?: string; + companyIcon?: string; +} + +export function Quote({ + quote, + author, + title, + companyIcon, +}: QuoteProps): JSX.Element { + return ( +
+ + +
+

+ {quote} +

+
+ +
+
+
+ {author} +
+ {title && ( +
+ {title} +
+ )} +
+ {companyIcon && ( +
+ +
+ )} +
+
+ ); +} diff --git a/nx-dev/ui-markdoc/src/lib/tags/quote.schema.ts b/nx-dev/ui-markdoc/src/lib/tags/quote.schema.ts new file mode 100644 index 0000000000..e3470438a5 --- /dev/null +++ b/nx-dev/ui-markdoc/src/lib/tags/quote.schema.ts @@ -0,0 +1,27 @@ +import { Schema } from '@markdoc/markdoc'; + +export const quote: Schema = { + render: 'Quote', + attributes: { + quote: { + type: 'String', + required: true, + }, + author: { + type: 'String', + required: true, + }, + title: { + type: 'String', + required: false, + }, + image: { + type: 'String', + required: false, + }, + companyIcon: { + type: 'String', + required: false, + }, + }, +};