Skip to content

Commit 47b3d49

Browse files
committed
feat(nx-dev): update youtube cmp to allow caption
1 parent 989f7f8 commit 47b3d49

File tree

4 files changed

+47
-33
lines changed

4 files changed

+47
-33
lines changed

nx-dev/ui-markdoc/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ import { SideBySide } from './lib/tags/side-by-side.component';
3737
import { sideBySide } from './lib/tags/side-by-side.schema';
3838
import { Tab, Tabs } from './lib/tags/tabs.component';
3939
import { tab, tabs } from './lib/tags/tabs.schema';
40-
import { YouTube } from './lib/tags/youtube.components';
41-
import { youtube } from './lib/tags/youtube.schema';
40+
import { YouTube, youtube } from './lib/tags/youtube.component';
4241
import {
4342
TerminalCommand,
4443
terminalCommand,
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { Schema } from '@markdoc/markdoc';
2+
3+
export const youtube: Schema = {
4+
render: 'YouTube',
5+
attributes: {
6+
src: {
7+
type: 'String',
8+
required: true,
9+
},
10+
title: {
11+
type: 'String',
12+
required: true,
13+
},
14+
width: {
15+
type: 'String',
16+
default: '50%',
17+
},
18+
caption: {
19+
// Added caption attribute here
20+
type: 'String',
21+
required: false, // Not required since it's optional
22+
},
23+
},
24+
};
25+
26+
export function YouTube(props: any): JSX.Element {
27+
return (
28+
<div className="text-center">
29+
{' '}
30+
{/* Center alignment applied to the container */}
31+
<iframe
32+
{...props}
33+
title={props.title}
34+
width={props.width || '50%'}
35+
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen"
36+
loading="lazy"
37+
className="rounded-lg shadow-lg mb-1"
38+
/>
39+
{props.caption && (
40+
<p className="w-1/2 mx-auto pt-0 text-slate-500 dark:text-slate-400">
41+
{props.caption}
42+
</p>
43+
)}
44+
</div>
45+
);
46+
}

nx-dev/ui-markdoc/src/lib/tags/youtube.components.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

nx-dev/ui-markdoc/src/lib/tags/youtube.schema.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy