diff --git a/directus b/directus index e7f53cf..9cd80de 160000 --- a/directus +++ b/directus @@ -1 +1 @@ -Subproject commit e7f53cfbabceb4fce388135e731d5e468619e806 +Subproject commit 9cd80dee6a36d95e9bb6ed4eb0a1cce3ced7c8da diff --git a/src/components/ChannelsList.tsx b/src/components/ChannelsList.tsx new file mode 100644 index 0000000..a9377c0 --- /dev/null +++ b/src/components/ChannelsList.tsx @@ -0,0 +1,37 @@ +import DirectusImage from "./DirectusImage"; +import { useTranslationTable } from "@/locales"; +import styles from "@/styles/ChannelsList.module.scss"; +import { SocialLink } from "@/types/aliases"; + +function Channel({ channel }: { channel: SocialLink }) { + return ( + + +

{channel.account_name}

+
+ ); +} + +export default function ChannelsList(props: { channels: SocialLink[] }) { + const tt = useTranslationTable(); + return ( +
+

{tt["join-our-channels"]}

+
+ {props.channels + .sort( + (a, b) => a.account_name?.localeCompare(b.account_name || "") || -1 + ) + .map((c) => ( + + ))} +
+
+ ); +} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 910d28c..bc933e9 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -3,6 +3,7 @@ import Decoration from "@/assets/decoration.svg"; import PreviewImage from "@/assets/galleryPreview.png"; import AssociationDescription from "@/components/AssociationDescription"; import Button from "@/components/Button"; +import ChannelsList from "@/components/ChannelsList"; import DirectusImage from "@/components/DirectusImage"; import Gallery from "@/components/Gallery"; import MembersList from "@/components/MembersList"; @@ -16,11 +17,7 @@ import { getDirectusImageUrl, populateLayoutProps, } from "@/directus"; -import { - getTranslation, - queryTranslations, - useTranslationTable, -} from "@/locales"; +import { getTranslation, useTranslationTable } from "@/locales"; import styles from "@/styles/Homepage.module.scss"; import { Association, @@ -89,6 +86,12 @@ export default function Home( + {props.association.channels?.length == 0 ? ( + <> + ) : ( + + )} + = populateLayoutProps(async (_) => { + var association = await directus().request( + readSingleton("association", { + fields: [ + "*", + // @ts-expect-error + { translations: ["*"] }, + // @ts-expect-error + { channels: ["*", { social_links_id: ["*"] }] }, + ], + }) + ); + + association.channels = association.channels?.map((c) => c.social_links_id); + return { props: { - association: await directus().request( - readSingleton("association", queryTranslations as any) - ), + association, partners: (await directus() .request( readItems("association_partners", { diff --git a/src/styles/ChannelsList.module.scss b/src/styles/ChannelsList.module.scss new file mode 100644 index 0000000..65064ad --- /dev/null +++ b/src/styles/ChannelsList.module.scss @@ -0,0 +1,43 @@ +@use "./utilities/variables"; + +.main { + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + background-color: variables.$white-background-color; + padding-top: 2rem; +} + +.image { + width: 6rem; + height: 6rem; + clip-path: circle(); +} + +.channel { + max-width: 6rem; + + &:hover { + transition: transform 0.2s ease; + transform: translateY(-5px); + } +} + +.list { + padding-top: 1rem; + display: flex; + gap: 4rem; + width: 100%; + align-items: baseline; + justify-content: center; + + p { + margin: 0.5rem 0 0 0; + font-weight: 400; + + color: variables.$dark-text-color; + text-align: center; + } +}