Skip to content

Commit

Permalink
Add Header and Footer custom types
Browse files Browse the repository at this point in the history
  • Loading branch information
IhsenBouallegue committed May 1, 2024
1 parent 8c8017a commit 24d0861
Show file tree
Hide file tree
Showing 13 changed files with 725 additions and 115 deletions.
60 changes: 60 additions & 0 deletions customtypes/footer/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"format": "custom",
"id": "footer",
"label": "Footer",
"repeatable": false,
"status": true,
"json": {
"Main": {
"navigation": {
"type": "Group",
"config": {
"label": "navigation",
"repeat": true,
"fields": {
"link": {
"type": "Link",
"config": {
"label": "link",
"placeholder": "",
"select": null
}
},
"label": {
"type": "Text",
"config": {
"label": "label",
"placeholder": ""
}
}
}
}
},
"socials": {
"type": "Group",
"config": {
"label": "Socials",
"repeat": true,
"fields": {
"social_platform": {
"type": "Select",
"config": {
"label": "Social Platform",
"placeholder": "",
"options": ["instagram", "linkedin", "discord", "youtube"]
}
},
"link": {
"type": "Link",
"config": {
"label": "link",
"placeholder": "",
"select": null
}
}
}
}
}
}
}
}
35 changes: 35 additions & 0 deletions customtypes/header/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"format": "custom",
"id": "header",
"label": "Header",
"repeatable": false,
"status": true,
"json": {
"Main": {
"navigation": {
"type": "Group",
"config": {
"label": "Navigation",
"repeat": true,
"fields": {
"label": {
"type": "Text",
"config": {
"label": "Label",
"placeholder": ""
}
},
"link": {
"type": "Link",
"config": {
"label": "Link",
"placeholder": "",
"select": null
}
}
}
}
}
}
}
}
10 changes: 10 additions & 0 deletions customtypes/settings/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"format": "custom",
"id": "settings",
"json": {
"Main": {}
},
"label": "Settings",
"repeatable": false,
"status": true
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"@react-three/drei": "^9.88.7",
Expand Down
186 changes: 185 additions & 1 deletion prismicio-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,158 @@ import type * as prismic from "@prismicio/client";

type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };

/**
* Item in *Footer → navigation*
*/
export interface FooterDocumentDataNavigationItem {
/**
* link field in *Footer → navigation*
*
* - **Field Type**: Link
* - **Placeholder**: *None*
* - **API ID Path**: footer.navigation[].link
* - **Documentation**: https://prismic.io/docs/field#link-content-relationship
*/
link: prismic.LinkField;

/**
* label field in *Footer → navigation*
*
* - **Field Type**: Text
* - **Placeholder**: *None*
* - **API ID Path**: footer.navigation[].label
* - **Documentation**: https://prismic.io/docs/field#key-text
*/
label: prismic.KeyTextField;
}

/**
* Item in *Footer → Socials*
*/
export interface FooterDocumentDataSocialsItem {
/**
* Social Platform field in *Footer → Socials*
*
* - **Field Type**: Select
* - **Placeholder**: *None*
* - **API ID Path**: footer.socials[].social_platform
* - **Documentation**: https://prismic.io/docs/field#select
*/
social_platform: prismic.SelectField<
"instagram" | "linkedin" | "discord" | "youtube"
>;

/**
* link field in *Footer → Socials*
*
* - **Field Type**: Link
* - **Placeholder**: *None*
* - **API ID Path**: footer.socials[].link
* - **Documentation**: https://prismic.io/docs/field#link-content-relationship
*/
link: prismic.LinkField;
}

/**
* Content for Footer documents
*/
interface FooterDocumentData {
/**
* navigation field in *Footer*
*
* - **Field Type**: Group
* - **Placeholder**: *None*
* - **API ID Path**: footer.navigation[]
* - **Tab**: Main
* - **Documentation**: https://prismic.io/docs/field#group
*/
navigation: prismic.GroupField<Simplify<FooterDocumentDataNavigationItem>>;

/**
* Socials field in *Footer*
*
* - **Field Type**: Group
* - **Placeholder**: *None*
* - **API ID Path**: footer.socials[]
* - **Tab**: Main
* - **Documentation**: https://prismic.io/docs/field#group
*/
socials: prismic.GroupField<Simplify<FooterDocumentDataSocialsItem>>;
}

/**
* Footer document from Prismic
*
* - **API ID**: `footer`
* - **Repeatable**: `false`
* - **Documentation**: https://prismic.io/docs/custom-types
*
* @typeParam Lang - Language API ID of the document.
*/
export type FooterDocument<Lang extends string = string> =
prismic.PrismicDocumentWithoutUID<
Simplify<FooterDocumentData>,
"footer",
Lang
>;

/**
* Item in *Header → Navigation*
*/
export interface HeaderDocumentDataNavigationItem {
/**
* Label field in *Header → Navigation*
*
* - **Field Type**: Text
* - **Placeholder**: *None*
* - **API ID Path**: header.navigation[].label
* - **Documentation**: https://prismic.io/docs/field#key-text
*/
label: prismic.KeyTextField;

/**
* Link field in *Header → Navigation*
*
* - **Field Type**: Link
* - **Placeholder**: *None*
* - **API ID Path**: header.navigation[].link
* - **Documentation**: https://prismic.io/docs/field#link-content-relationship
*/
link: prismic.LinkField;
}

/**
* Content for Header documents
*/
interface HeaderDocumentData {
/**
* Navigation field in *Header*
*
* - **Field Type**: Group
* - **Placeholder**: *None*
* - **API ID Path**: header.navigation[]
* - **Tab**: Main
* - **Documentation**: https://prismic.io/docs/field#group
*/
navigation: prismic.GroupField<Simplify<HeaderDocumentDataNavigationItem>>;
}

/**
* Header document from Prismic
*
* - **API ID**: `header`
* - **Repeatable**: `false`
* - **Documentation**: https://prismic.io/docs/custom-types
*
* @typeParam Lang - Language API ID of the document.
*/
export type HeaderDocument<Lang extends string = string> =
prismic.PrismicDocumentWithoutUID<
Simplify<HeaderDocumentData>,
"header",
Lang
>;

type HomeDocumentDataSlicesSlice =
| CallToActionSlice
| TestemonialsSlice
Expand Down Expand Up @@ -143,7 +295,30 @@ interface PageDocumentData {
export type PageDocument<Lang extends string = string> =
prismic.PrismicDocumentWithUID<Simplify<PageDocumentData>, "page", Lang>;

export type AllDocumentTypes = HomeDocument | PageDocument;
interface SettingsDocumentData {}

/**
* Settings document from Prismic
*
* - **API ID**: `settings`
* - **Repeatable**: `false`
* - **Documentation**: https://prismic.io/docs/custom-types
*
* @typeParam Lang - Language API ID of the document.
*/
export type SettingsDocument<Lang extends string = string> =
prismic.PrismicDocumentWithoutUID<
Simplify<SettingsDocumentData>,
"settings",
Lang
>;

export type AllDocumentTypes =
| FooterDocument
| HeaderDocument
| HomeDocument
| PageDocument
| SettingsDocument;

/**
* Primary content in *Article → Primary*
Expand Down Expand Up @@ -677,12 +852,21 @@ declare module "@prismicio/client" {

namespace Content {
export type {
FooterDocument,
FooterDocumentData,
FooterDocumentDataNavigationItem,
FooterDocumentDataSocialsItem,
HeaderDocument,
HeaderDocumentData,
HeaderDocumentDataNavigationItem,
HomeDocument,
HomeDocumentData,
HomeDocumentDataSlicesSlice,
PageDocument,
PageDocumentData,
PageDocumentDataSlicesSlice,
SettingsDocument,
SettingsDocumentData,
AllDocumentTypes,
ArticleSlice,
ArticleSliceDefaultPrimary,
Expand Down
Loading

0 comments on commit 24d0861

Please sign in to comment.