diff --git a/src/components/ConditionalWrapper.astro b/src/components/ConditionalWrapper.astro index 61527f9..a3cb4d3 100644 --- a/src/components/ConditionalWrapper.astro +++ b/src/components/ConditionalWrapper.astro @@ -1,17 +1,18 @@ --- -interface Props { - wrapper: (props?: any) => any; +interface Props> { + wrapper: (props: T) => any; + props?: T; condition: boolean; } -const { wrapper: Wrapper, condition } = Astro.props; +const { wrapper: Wrapper, condition, props } = Astro.props; --- {/* ------------------------------------------- HTML ------------------------------------------- */} { condition ? ( - + ) : ( diff --git a/src/components/Link.astro b/src/components/Link.astro new file mode 100644 index 0000000..00687b3 --- /dev/null +++ b/src/components/Link.astro @@ -0,0 +1,9 @@ +--- +interface Props { + href: string; +} + +const { href } = Astro.props; +--- + + diff --git a/src/pages/[locale]/collectibles/_components/ContentsSection/ContentRow.astro b/src/pages/[locale]/collectibles/_components/ContentsSection/ContentRow.astro index 811bf51..ec1c3f9 100644 --- a/src/pages/[locale]/collectibles/_components/ContentsSection/ContentRow.astro +++ b/src/pages/[locale]/collectibles/_components/ContentsSection/ContentRow.astro @@ -4,6 +4,9 @@ import RichText from "components/RichText/RichText.astro"; import { getI18n } from "src/i18n/i18n"; import type { EndpointCollectible } from "src/shared/payload/payload-sdk"; import { formatInlineTitle } from "src/utils/format"; +import InlineTagGroups from "./InlineTagGroups.astro"; +import ConditionalWrapper from "components/ConditionalWrapper.astro"; +import Link from "components/Link.astro"; interface Props { content: EndpointCollectible["contents"][number]; @@ -13,71 +16,116 @@ const { getLocalizedMatch, getLocalizedUrl } = await getI18n(Astro.locals.curren const { content: { content, range }, } = Astro.props; + +const href = + content.relationTo === "pages" ? getLocalizedUrl(`/pages/${content.value.slug}`) : undefined; --- {/* ------------------------------------------- HTML ------------------------------------------- */} -
-
+ +
+
+ { + content.relationTo === "generic-contents" ? ( +

{getLocalizedMatch(content.value.translations).name}

+ ) : content.relationTo === "pages" ? ( +

{formatInlineTitle(getLocalizedMatch(content.value.translations))}

+ ) : ( + + ) + } +
+ +
+ +
+ { + range && ( + <> + {range.type === "pageRange" ? ( + range.start + ) : range.type === "timeRange" ? ( + range.start + ) : range.type === "other" ? ( + + ) : ( + + )} + + ) + } +
+ { - content.relationTo === "generic-contents" ? ( -

{getLocalizedMatch(content.value.translations).name}

- ) : content.relationTo === "pages" ? ( - - {formatInlineTitle(getLocalizedMatch(content.value.translations))} - - ) : ( - + content.relationTo === "pages" && content.value.tagGroups.length > 0 && ( +
+ +
) }
- -
- -
- { - range && ( - <> - {range.type === "pageRange" ? ( - range.start - ) : range.type === "timeRange" ? ( - range.start - ) : range.type === "other" ? ( - - ) : ( - - )} - - ) - } -
-
+ {/* ------------------------------------------- CSS -------------------------------------------- */} diff --git a/src/pages/[locale]/collectibles/_components/ContentsSection/ContentsSection.astro b/src/pages/[locale]/collectibles/_components/ContentsSection/ContentsSection.astro index 4207d92..7f829ae 100644 --- a/src/pages/[locale]/collectibles/_components/ContentsSection/ContentsSection.astro +++ b/src/pages/[locale]/collectibles/_components/ContentsSection/ContentsSection.astro @@ -42,6 +42,6 @@ const { t } = await getI18n(Astro.locals.currentLocale); #contents { display: grid; - gap: 8px; + gap: 1em; }