Skip to content

Commit

Permalink
use improved types
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoSoaress committed Nov 10, 2023
1 parent 1324e78 commit 8036cd8
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/contentful/types/TypeCardGridItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { ChainModifiers, Entry, EntryFieldTypes, EntrySkeletonType, LocaleCode } from 'contentful'

export interface TypeCardGridItemFields {
title: EntryFieldTypes.Symbol
text: EntryFieldTypes.Text
image?: EntryFieldTypes.AssetLink
}

export type TypeCardGridItemSkeleton = EntrySkeletonType<TypeCardGridItemFields, 'cardGridItem'>
export type TypeCardGridItem<Modifiers extends ChainModifiers, Locales extends LocaleCode> = Entry<
TypeCardGridItemSkeleton,
Modifiers,
Locales
>
3 changes: 2 additions & 1 deletion src/contentful/types/TypeFaq.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { ChainModifiers, Entry, EntryFieldTypes, EntrySkeletonType, LocaleCode } from 'contentful'
import type { TypeFaqEntrySkeleton } from './TypeFaqEntry'

export interface TypeFaqFields {
title: EntryFieldTypes.Symbol
list: EntryFieldTypes.Object<{ question: 'string'; answer: 'string' }>
items: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<TypeFaqEntrySkeleton>>
}

export type TypeFaqSkeleton = EntrySkeletonType<TypeFaqFields, 'faq'>
Expand Down
13 changes: 13 additions & 0 deletions src/contentful/types/TypeFaqEntry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ChainModifiers, Entry, EntryFieldTypes, EntrySkeletonType, LocaleCode } from 'contentful'

export interface TypeFaqEntryFields {
question: EntryFieldTypes.Symbol
answer: EntryFieldTypes.Text
}

export type TypeFaqEntrySkeleton = EntrySkeletonType<TypeFaqEntryFields, 'faqEntry'>
export type TypeFaqEntry<Modifiers extends ChainModifiers, Locales extends LocaleCode> = Entry<
TypeFaqEntrySkeleton,
Modifiers,
Locales
>
4 changes: 2 additions & 2 deletions src/contentful/types/TypeRoundCardGrid.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { ChainModifiers, Entry, EntryFieldTypes, EntrySkeletonType, LocaleCode } from 'contentful'
import type { TypeButtonSkeleton } from './TypeButton'
import type { TypeCardGridItemSkeleton } from './TypeCardGridItem'

export interface TypeRoundCardGridFields {
title: EntryFieldTypes.Symbol
text: EntryFieldTypes.Text
link?: EntryFieldTypes.EntryLink<TypeButtonSkeleton>
items?: EntryFieldTypes.Object<{ title: 'string'; text: 'string' }>
cardImages?: EntryFieldTypes.Array<EntryFieldTypes.AssetLink>
gridItems: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<TypeCardGridItemSkeleton>>
}

export type TypeRoundCardGridSkeleton = EntrySkeletonType<TypeRoundCardGridFields, 'roundCardGrid'>
Expand Down
3 changes: 2 additions & 1 deletion src/contentful/types/TypeTitleSpaceBetweenGrid.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { ChainModifiers, Entry, EntryFieldTypes, EntrySkeletonType, LocaleCode } from 'contentful'
import type { TypeCardGridItemSkeleton } from './TypeCardGridItem'

export interface TypeTitleSpaceBetweenGridFields {
title: EntryFieldTypes.Symbol
stats?: EntryFieldTypes.Object<{ text: 'string'; value: 'string' }>
items: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<TypeCardGridItemSkeleton>>
}

export type TypeTitleSpaceBetweenGridSkeleton = EntrySkeletonType<
Expand Down
2 changes: 2 additions & 0 deletions src/contentful/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export type { TypeButton, TypeButtonFields, TypeButtonSkeleton } from './TypeButton'
export type { TypeCampaignTitle, TypeCampaignTitleFields, TypeCampaignTitleSkeleton } from './TypeCampaignTitle'
export type { TypeCardGridItem, TypeCardGridItemFields, TypeCardGridItemSkeleton } from './TypeCardGridItem'
export type { TypeContentOrder, TypeContentOrderFields, TypeContentOrderSkeleton } from './TypeContentOrder'
export type { TypeFaq, TypeFaqFields, TypeFaqSkeleton } from './TypeFaq'
export type { TypeFaqEntry, TypeFaqEntryFields, TypeFaqEntrySkeleton } from './TypeFaqEntry'
export type { TypeHero, TypeHeroFields, TypeHeroSkeleton } from './TypeHero'
export type { TypeMetaTags, TypeMetaTagsFields, TypeMetaTagsSkeleton } from './TypeMetaTags'
export type { TypeRoundCardGrid, TypeRoundCardGridFields, TypeRoundCardGridSkeleton } from './TypeRoundCardGrid'
Expand Down

0 comments on commit 8036cd8

Please sign in to comment.