-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nx-dev): update youtube cmp to allow caption
- Loading branch information
Showing
4 changed files
with
47 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
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,46 @@ | ||
import { Schema } from '@markdoc/markdoc'; | ||
|
||
export const youtube: Schema = { | ||
render: 'YouTube', | ||
attributes: { | ||
src: { | ||
type: 'String', | ||
required: true, | ||
}, | ||
title: { | ||
type: 'String', | ||
required: true, | ||
}, | ||
width: { | ||
type: 'String', | ||
default: '50%', | ||
}, | ||
caption: { | ||
// Added caption attribute here | ||
type: 'String', | ||
required: false, // Not required since it's optional | ||
}, | ||
}, | ||
}; | ||
|
||
export function YouTube(props: any): JSX.Element { | ||
return ( | ||
<div className="text-center"> | ||
{' '} | ||
{/* Center alignment applied to the container */} | ||
<iframe | ||
{...props} | ||
title={props.title} | ||
width={props.width || '50%'} | ||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" | ||
loading="lazy" | ||
className="rounded-lg shadow-lg mb-1" | ||
/> | ||
{props.caption && ( | ||
<p className="w-1/2 mx-auto pt-0 text-slate-500 dark:text-slate-400"> | ||
{props.caption} | ||
</p> | ||
)} | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.