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

Feature/strapi video component #49

Merged
merged 4 commits into from
Jan 9, 2025
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
39 changes: 39 additions & 0 deletions nextjs/src/app/[locale]/(partners-products)/partners-products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import ButtonGroup from "@/components/button-group"
import NavBar from "@/components/nav-bar/nav-bar"
import { LinkedLocale } from "@/components/nav-bar/linked-locales-provider"
import { notFound } from "next/navigation"
import ExternalScript from "@/components/external-script"
import SectionCardWide from "@/components/sections/section-card-wide"
import { youtubeSection } from "@/app/[locale]/theme/texts"

export default async function PartnersProducts({
activeLocale,
Expand Down Expand Up @@ -175,6 +178,42 @@ function dynamicSection(section: any, index: number) {
</SectionGroup>
</Container>
)
case "sections.video-section":
return (
<Container
key={`section_video-section_${index}`}
background={section.props.background}
padding={section.props.padding}
>
<SectionGroup title={section.section_title}>
<ExternalScript
html={section.embed_html}
className="w-full h-auto"
/>
</SectionGroup>
</Container>
)
case "sections.video-with-text-section":
return (
<Container
key={`section_video-section_${index}`}
background={section.props.background}
padding={section.props.padding}
>
<SectionGroup title={section.section_title}>
<SectionCardWide
childrenWide={
<ExternalScript
html={section.embed_html}
className="w-full h-auto"
/>
}
>
<Text markdown={section.body} />
</SectionCardWide>
</SectionGroup>
</Container>
)
default:
return <p key={`section_${index}`}>Unknown section</p>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"info": {
"singularName": "page-partner-and-product",
"pluralName": "page-partner-and-products",
"displayName": "Page Partner & Product"
"displayName": "Page Partner & Product",
"description": ""
},
"options": {
"draftAndPublish": true
Expand Down Expand Up @@ -73,7 +74,9 @@
"sections.heading-with-link-container",
"relations.white-paper-section",
"relations.quotes-relation",
"relations.calendly-section"
"relations.calendly-section",
"sections.video-section",
"sections.video-with-text-section"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ const populate = {
},
},
},
'sections.video-section': {
populate: '*',
},
'sections.video-with-text-section': {
populate: '*',
},
},
}
};
Expand Down
26 changes: 26 additions & 0 deletions strapi/src/components/sections/video-section.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"collectionName": "components_sections_video_sections",
"info": {
"displayName": "Video Section",
"icon": "play",
"description": ""
},
"options": {},
"attributes": {
"section_title": {
"type": "string",
"required": true
},
"embed_html": {
"type": "text",
"required": true,
"default": "use this tool to embed video https://embedresponsively.com/"
},
"props": {
"type": "component",
"repeatable": false,
"component": "sections.section-props",
"required": true
}
}
}
28 changes: 28 additions & 0 deletions strapi/src/components/sections/video-with-text-section.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"collectionName": "components_sections_video_with_text_sections",
"info": {
"displayName": "Video With Text Section",
"icon": "play"
},
"options": {},
"attributes": {
"props": {
"type": "component",
"repeatable": false,
"component": "sections.section-props",
"required": true
},
"section_title": {
"type": "string",
"required": true
},
"embed_html": {
"type": "text",
"required": true
},
"body": {
"type": "richtext",
"required": true
}
}
}
34 changes: 34 additions & 0 deletions strapi/types/generated/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,38 @@ export interface SectionsTwoColumnSection extends Struct.ComponentSchema {
};
}

export interface SectionsVideoSection extends Struct.ComponentSchema {
collectionName: 'components_sections_video_sections';
info: {
description: '';
displayName: 'Video Section';
icon: 'play';
};
attributes: {
embed_html: Schema.Attribute.Text &
Schema.Attribute.Required &
Schema.Attribute.DefaultTo<'use this tool to embed video https://embedresponsively.com/'>;
props: Schema.Attribute.Component<'sections.section-props', false> &
Schema.Attribute.Required;
section_title: Schema.Attribute.String & Schema.Attribute.Required;
};
}

export interface SectionsVideoWithTextSection extends Struct.ComponentSchema {
collectionName: 'components_sections_video_with_text_sections';
info: {
displayName: 'Video With Text Section';
icon: 'play';
};
attributes: {
body: Schema.Attribute.RichText & Schema.Attribute.Required;
embed_html: Schema.Attribute.Text & Schema.Attribute.Required;
props: Schema.Attribute.Component<'sections.section-props', false> &
Schema.Attribute.Required;
section_title: Schema.Attribute.String & Schema.Attribute.Required;
};
}

declare module '@strapi/strapi' {
export module Public {
export interface ComponentSchemas {
Expand Down Expand Up @@ -778,6 +810,8 @@ declare module '@strapi/strapi' {
'sections.section-with-richt-heading-intro-and-cta': SectionsSectionWithRichtHeadingIntroAndCta;
'sections.text-section-with-cta': SectionsTextSectionWithCta;
'sections.two-column-section': SectionsTwoColumnSection;
'sections.video-section': SectionsVideoSection;
'sections.video-with-text-section': SectionsVideoWithTextSection;
}
}
}
3 changes: 3 additions & 0 deletions strapi/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ export interface ApiPagePartnerAndProductPagePartnerAndProduct
extends Struct.CollectionTypeSchema {
collectionName: 'page_partner_and_products';
info: {
description: '';
displayName: 'Page Partner & Product';
pluralName: 'page-partner-and-products';
singularName: 'page-partner-and-product';
Expand Down Expand Up @@ -1021,6 +1022,8 @@ export interface ApiPagePartnerAndProductPagePartnerAndProduct
'relations.white-paper-section',
'relations.quotes-relation',
'relations.calendly-section',
'sections.video-section',
'sections.video-with-text-section',
]
> &
Schema.Attribute.SetPluginOptions<{
Expand Down
Loading