feat: add list block component
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { Edges } from "../utils/edges"
|
||||
import type { ExternalLink } from "../utils/externalLink"
|
||||
import type { PageLink } from "../utils/pageLink"
|
||||
import { Typename } from "../utils/typename"
|
||||
|
||||
enum ListItemStyleEnum {
|
||||
checkmark = "checkmark",
|
||||
@@ -9,38 +10,62 @@ enum ListItemStyleEnum {
|
||||
|
||||
type ListItemStyle = keyof typeof ListItemStyleEnum
|
||||
|
||||
type ExternalLinkListItem = {
|
||||
list_item_external_link: {
|
||||
link: {
|
||||
href: string
|
||||
export enum BlockListItemsEnum {
|
||||
CurrentBlocksPageBlocksListBlockListItemsListItem = "CurrentBlocksPageBlocksListBlockListItemsListItem",
|
||||
CurrentBlocksPageBlocksListBlockListItemsListItemExternalLink = "CurrentBlocksPageBlocksListBlockListItemsListItemExternalLink",
|
||||
CurrentBlocksPageBlocksListBlockListItemsListItemInternalLink = "CurrentBlocksPageBlocksListBlockListItemsListItemInternalLink",
|
||||
}
|
||||
|
||||
type ExternalLinkListItem = Typename<
|
||||
{
|
||||
list_item_external_link: {
|
||||
link: {
|
||||
href: string
|
||||
title: string
|
||||
}
|
||||
list_item_style: ListItemStyle
|
||||
subtitle?: string
|
||||
}
|
||||
},
|
||||
BlockListItemsEnum.CurrentBlocksPageBlocksListBlockListItemsListItemExternalLink
|
||||
>
|
||||
|
||||
type InternalLinkListItem = Typename<
|
||||
{
|
||||
list_item_internal_link: {
|
||||
link_text?: string
|
||||
list_item_style: ListItemStyle
|
||||
subtitle?: string
|
||||
pageConnection: Edges<ExternalLink | PageLink>
|
||||
}
|
||||
},
|
||||
BlockListItemsEnum.CurrentBlocksPageBlocksListBlockListItemsListItemInternalLink
|
||||
>
|
||||
|
||||
type RegularListItem = Typename<
|
||||
{
|
||||
list_item: {
|
||||
list_item_style: ListItemStyle
|
||||
subtitle?: string
|
||||
title: string
|
||||
}
|
||||
list_item_style: ListItemStyle
|
||||
subtitle?: string
|
||||
}
|
||||
}
|
||||
},
|
||||
BlockListItemsEnum.CurrentBlocksPageBlocksListBlockListItemsListItem
|
||||
>
|
||||
|
||||
type InternalLinkListItem = {
|
||||
list_item_internal_link: {
|
||||
link_text?: string
|
||||
list_item_style: ListItemStyle
|
||||
subtitle?: string
|
||||
pageConnection: Edges<ExternalLink | PageLink>
|
||||
}
|
||||
}
|
||||
|
||||
type RegularListItem = {
|
||||
list_item: {
|
||||
list_item_style: ListItemStyle
|
||||
subtitle?: string
|
||||
title: string
|
||||
}
|
||||
}
|
||||
|
||||
type ListItem = ExternalLinkListItem | InternalLinkListItem | RegularListItem
|
||||
export type ListItem =
|
||||
| ExternalLinkListItem
|
||||
| InternalLinkListItem
|
||||
| RegularListItem
|
||||
|
||||
export type List = {
|
||||
list: {
|
||||
list_items: ListItem
|
||||
title?: string
|
||||
list_items: ListItem[]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export type ListProps = {
|
||||
listBlock: List
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user