diff --git a/back/src/api/orri-basikoa/content-types/orri-basikoa/schema.json b/back/src/api/orri-basikoa/content-types/orri-basikoa/schema.json index 9a9eb9e..e332b24 100644 --- a/back/src/api/orri-basikoa/content-types/orri-basikoa/schema.json +++ b/back/src/api/orri-basikoa/content-types/orri-basikoa/schema.json @@ -27,8 +27,8 @@ "type": "dynamiczone", "components": [ "paragraph.testua", - "paragraph.youtube", - "paragraph.irudia" + "paragraph.irudia", + "paragraph.call-to-action" ] } } diff --git a/back/src/components/paragraph/call-to-action.json b/back/src/components/paragraph/call-to-action.json new file mode 100644 index 0000000..21dfb54 --- /dev/null +++ b/back/src/components/paragraph/call-to-action.json @@ -0,0 +1,19 @@ +{ + "collectionName": "components_paragraph_call_to_actions", + "info": { + "displayName": "call to action", + "icon": "rocket" + }, + "options": {}, + "attributes": { + "url": { + "type": "string", + "required": true + }, + "label": { + "type": "string", + "required": true + } + }, + "config": {} +} diff --git a/back/types/generated/components.d.ts b/back/types/generated/components.d.ts index b080547..82a9373 100644 --- a/back/types/generated/components.d.ts +++ b/back/types/generated/components.d.ts @@ -89,6 +89,18 @@ export interface HasieraUrl extends Struct.ComponentSchema { }; } +export interface ParagraphCallToAction extends Struct.ComponentSchema { + collectionName: 'components_paragraph_call_to_actions'; + info: { + displayName: 'call to action'; + icon: 'rocket'; + }; + attributes: { + label: Schema.Attribute.String & Schema.Attribute.Required; + url: Schema.Attribute.String & Schema.Attribute.Required; + }; +} + export interface ParagraphIrudia extends Struct.ComponentSchema { collectionName: 'components_paragraph_irudias'; info: { @@ -135,6 +147,7 @@ declare module '@strapi/strapi' { 'hasiera.parte-hartu': HasieraParteHartu; 'hasiera.parte-hartzea': HasieraParteHartzea; 'hasiera.url': HasieraUrl; + 'paragraph.call-to-action': ParagraphCallToAction; 'paragraph.irudia': ParagraphIrudia; 'paragraph.testua': ParagraphTestua; 'paragraph.youtube': ParagraphYoutube; diff --git a/back/types/generated/contentTypes.d.ts b/back/types/generated/contentTypes.d.ts index b84c601..cca43f7 100644 --- a/back/types/generated/contentTypes.d.ts +++ b/back/types/generated/contentTypes.d.ts @@ -495,7 +495,7 @@ export interface ApiOrriBasikoaOrriBasikoa extends Struct.CollectionTypeSchema { Schema.Attribute.Private; deskribapena: Schema.Attribute.Text; edukiLibrea: Schema.Attribute.DynamicZone< - ['paragraph.testua', 'paragraph.youtube', 'paragraph.irudia'] + ['paragraph.testua', 'paragraph.irudia', 'paragraph.call-to-action'] >; izenburua: Schema.Attribute.String & Schema.Attribute.Required; locale: Schema.Attribute.String & Schema.Attribute.Private; diff --git a/front/src/content.config.ts b/front/src/content.config.ts index d84db41..ed806e4 100644 --- a/front/src/content.config.ts +++ b/front/src/content.config.ts @@ -118,6 +118,12 @@ const orriBasikoak = defineCollection({ formats } } + ... on ComponentParagraphCallToAction { + type: __typename + id + url + label + } } } } diff --git a/front/src/models/OrriBasikoa.ts b/front/src/models/OrriBasikoa.ts index 3108028..cb6f5e0 100644 --- a/front/src/models/OrriBasikoa.ts +++ b/front/src/models/OrriBasikoa.ts @@ -13,7 +13,17 @@ interface ParagraphTestua { testua: Markdown; } -export type Paragraph = ParagraphTestua | ParagraphIrudia; +interface ParagraphCallToAction { + type: "ComponentParagraphCallToAction"; + id: string; + url: string; + label: string; +} + +export type Paragraph = + | ParagraphTestua + | ParagraphIrudia + | ParagraphCallToAction; export interface OrriBasikoa { id: string; diff --git a/front/src/views/orriBasikoa/_components/EdukiLibrea.astro b/front/src/views/orriBasikoa/_components/EdukiLibrea.astro index 6b035f5..54585f2 100644 --- a/front/src/views/orriBasikoa/_components/EdukiLibrea.astro +++ b/front/src/views/orriBasikoa/_components/EdukiLibrea.astro @@ -2,6 +2,7 @@ import type { Paragraph } from "models/OrriBasikoa"; import ParagraphIrudia from "./ParagraphIrudia.astro"; import ParagraphTestua from "./ParagraphTestua.astro"; +import ParagraphCallToAction from "./ParagraphCallToAction.astro"; interface Props { paragraph: Paragraph; @@ -17,6 +18,12 @@ const { paragraph } = Astro.props; ) } + { + paragraph.type === "ComponentParagraphCallToAction" && ( + + ) + } + { paragraph.type === "ComponentParagraphTestua" && ( diff --git a/front/src/views/orriBasikoa/_components/ParagraphCallToAction.astro b/front/src/views/orriBasikoa/_components/ParagraphCallToAction.astro new file mode 100644 index 0000000..49778ca --- /dev/null +++ b/front/src/views/orriBasikoa/_components/ParagraphCallToAction.astro @@ -0,0 +1,47 @@ +--- +interface Props { + url: string; + label: string; +} + +const { url, label } = Astro.props; +--- + +
+ {label} +
+ +