Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add video block to CMS and Frontend #2548

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion workspaces/cms-config/src/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,18 @@ export const blocks = [
}
],
},
{
name: "youtube",
label: "Youtube",
widget: "object",
fields: [
{
name: "videoId",
widget: "string",
crowdin: true
}
]
},
{
name: "ambassadors_list",
label: "Ambassadors list",
Expand Down Expand Up @@ -825,7 +837,7 @@ const flexLayout = {
default: [],
},
],
} satisfies CmsField;
} satisfies CmsField;

export const topLevelBlocks = [
{
Expand Down
6 changes: 6 additions & 0 deletions workspaces/cms-data/src/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export interface ImageIconLinkCardBlock {
| "grey";
}

export interface YoutubeBlock {
readonly type: "youtube";
readonly videoId: string;
}

export interface ListCardItems {
title: string;
description: string;
Expand Down Expand Up @@ -175,6 +180,7 @@ export type Block =
| CommunityEventsBlock
| BasicCardBlock
| ImageIconLinkCardBlock
| YoutubeBlock
| HeroBlock
| HomeHeroBlock
| LinkListBlock
Expand Down
3 changes: 3 additions & 0 deletions workspaces/website/src/blocks/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { usePageContext } from "src/renderer/PageContextProvider";
import { HeadingContainer } from "./HeadingContainer";
import VideoSectionBlock from "./VideoSectionBlock";
import { NewsletterCard } from "@ui/Card/NewsletterCard";
import { YoutubePlayer } from "@ui/YoutubePlayer/YoutubePlayer";

interface Props {
disallowH1?: boolean;
Expand Down Expand Up @@ -48,6 +49,8 @@ export function Block({ disallowH1, block, env, locale }: Props): JSX.Element |
);
} else if (block.type === "image_icon_link_card") {
return <ImageIconCard {...block} locale={locale} />;
} else if (block.type === "youtube") {
return <YoutubePlayer videoId={block.videoId} />
} else if (block.type === "newsletter_popup") {
return <NewsletterCard {...block} env={env} locale={locale} />;
} else if (block.type === "markdown") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
height: 0;
padding-bottom: 56.25%;
overflow: hidden;
margin-bottom: 50px;
}

.youtubeContainer iframe {
Expand Down
Loading