From b9e02d152bf58c52de8ffc92d1dab69c9eee1fd1 Mon Sep 17 00:00:00 2001 From: Isaac Mann Date: Wed, 8 Nov 2023 11:17:41 -0500 Subject: [PATCH] feat(nx-dev): call to action button --- docs/nx-cloud/intro/nx-cloud-workflows.md | 2 + nx-dev/ui-markdoc/src/index.ts | 4 ++ .../src/lib/tags/call-to-action.component.tsx | 41 +++++++++++++++++++ .../src/lib/tags/call-to-action.schema.ts | 29 +++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 nx-dev/ui-markdoc/src/lib/tags/call-to-action.component.tsx create mode 100644 nx-dev/ui-markdoc/src/lib/tags/call-to-action.schema.ts diff --git a/docs/nx-cloud/intro/nx-cloud-workflows.md b/docs/nx-cloud/intro/nx-cloud-workflows.md index 0a18ea9387376..016a57543b271 100644 --- a/docs/nx-cloud/intro/nx-cloud-workflows.md +++ b/docs/nx-cloud/intro/nx-cloud-workflows.md @@ -5,6 +5,8 @@ src="https://www.youtube.com/embed/JG1FWfZFByM" title="Introducing Nx Cloud Workflows" width="100%" /%} +{% call-to-action title="Sign Up for Early Access" icon="nxcloud" description="Experience Nx Cloud Workflows for yourself" url="https://cloud.nx.app/workflows-early-access" /%} + ## Powerful CI Capabilities Optimized for Nx monorepos Just like Nx and Nx Cloud, Nx Cloud Workflows enables you to offload tedious technical tasks so that you can focus on more mission-critical tasks. With a traditional CI platform, you are responsible for telling the CI platform exactly what commands to execute in which environments and what to do with the artifacts. Nx Cloud by itself can automate parallelizing tasks and sharing build artifacts across machines, but you still have to create agent machines on your CI platform. diff --git a/nx-dev/ui-markdoc/src/index.ts b/nx-dev/ui-markdoc/src/index.ts index 9c4b875dbadc5..37c21e3376369 100644 --- a/nx-dev/ui-markdoc/src/index.ts +++ b/nx-dev/ui-markdoc/src/index.ts @@ -17,6 +17,8 @@ import { CustomLink } from './lib/nodes/link.component'; import { link } from './lib/nodes/link.schema'; import { Callout } from './lib/tags/callout.component'; import { callout } from './lib/tags/callout.schema'; +import { CallToAction } from './lib/tags/call-to-action.component'; +import { callToAction } from './lib/tags/call-to-action.schema'; import { Card, Cards, LinkCard } from './lib/tags/cards.component'; import { card, cards, linkCard } from './lib/tags/cards.schema'; import { GithubRepository } from './lib/tags/github-repository.component'; @@ -66,6 +68,7 @@ export const getMarkdocCustomConfig = ( }, tags: { callout, + 'call-to-action': callToAction, card, cards, 'link-card': linkCard, @@ -90,6 +93,7 @@ export const getMarkdocCustomConfig = ( }, components: { Callout, + CallToAction, Card, Cards, LinkCard, diff --git a/nx-dev/ui-markdoc/src/lib/tags/call-to-action.component.tsx b/nx-dev/ui-markdoc/src/lib/tags/call-to-action.component.tsx new file mode 100644 index 0000000000000..bbc171aee7fd6 --- /dev/null +++ b/nx-dev/ui-markdoc/src/lib/tags/call-to-action.component.tsx @@ -0,0 +1,41 @@ +import { ChevronRightIcon } from '@heroicons/react/24/outline'; +import { frameworkIcons } from '../icons'; + +export function CallToAction({ + url, + title, + description, + icon = 'nx', +}: { + url: string; + title: string; + description?: string; + icon?: string; +}): JSX.Element { + return ( +
+
+
+ +
+
{icon && frameworkIcons[icon]?.image}
+ +
+

+ {title} + + + {description || ''} + +

+
+
+ +
+ ); +} diff --git a/nx-dev/ui-markdoc/src/lib/tags/call-to-action.schema.ts b/nx-dev/ui-markdoc/src/lib/tags/call-to-action.schema.ts new file mode 100644 index 0000000000000..3cde37b758537 --- /dev/null +++ b/nx-dev/ui-markdoc/src/lib/tags/call-to-action.schema.ts @@ -0,0 +1,29 @@ +import { Schema } from '@markdoc/markdoc'; + +export const callToAction: Schema = { + // 'Display content in a large button.', + render: 'CallToAction', + attributes: { + url: { + // 'The url to link to', + type: 'String', + required: true, + }, + title: { + // 'Title of the call to action', + type: 'String', + required: true, + }, + description: { + // 'Description of the call to action. Defaults to an empty string', + type: 'String', + required: false, + }, + icon: { + // 'Icon displayed to the left of the call to actions. Defaults to the Nx icon', + // Choose from the list in nx-dev/ui-markdoc/src/lib/icons.tsx + type: 'String', + required: false, + }, + }, +};