Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40f54d5
commit b9e02d1
Showing
4 changed files
with
76 additions
and
0 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
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
41 changes: 41 additions & 0 deletions
41
nx-dev/ui-markdoc/src/lib/tags/call-to-action.component.tsx
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,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 ( | ||
<div className="not-prose group relative my-12 mx-auto flex w-full max-w-md items-center gap-3 overflow-hidden rounded-lg bg-slate-50 shadow-md transition hover:text-white dark:bg-slate-800/60"> | ||
<div className="absolute inset-0 z-0 w-2 bg-blue-500 transition-all duration-150 group-hover:w-full dark:bg-sky-500"></div> | ||
<div className="w-2 bg-blue-500 dark:bg-sky-500"></div> | ||
|
||
<div className="z-10 flex flex-grow items-center py-3"> | ||
<div className="h-10 w-10">{icon && frameworkIcons[icon]?.image}</div> | ||
|
||
<div className="mx-3"> | ||
<p> | ||
{title} | ||
<a | ||
href={url} | ||
target="_blank" | ||
rel="noreferrer" | ||
className="block text-sm font-medium opacity-80" | ||
> | ||
<span className="absolute inset-0" aria-hidden="true"></span> | ||
{description || ''} | ||
</a> | ||
</p> | ||
</div> | ||
</div> | ||
<ChevronRightIcon className="mr-4 h-6 w-6 transition-all group-hover:translate-x-3" /> | ||
</div> | ||
); | ||
} |
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,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, | ||
}, | ||
}, | ||
}; |
b9e02d1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx.dev
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app