fix: better code organisation for ContentType components
This commit is contained in:
29
components/ContentType/LoyaltyPage/LoyaltyPage.tsx
Normal file
29
components/ContentType/LoyaltyPage/LoyaltyPage.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { Blocks } from "@/components/Loyalty/Blocks"
|
||||
import Sidebar from "@/components/Loyalty/Sidebar"
|
||||
import MaxWidth from "@/components/MaxWidth"
|
||||
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||
|
||||
import styles from "./loyaltyPage.module.css"
|
||||
|
||||
import type { LangParams } from "@/types/params"
|
||||
|
||||
export default async function LoyaltyPage({ lang }: LangParams) {
|
||||
const loyaltyPage = await serverClient().contentstack.loyaltyPage.get()
|
||||
if (!loyaltyPage) {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<section className={styles.content}>
|
||||
{loyaltyPage.sidebar.length ? (
|
||||
<Sidebar blocks={loyaltyPage.sidebar} lang={lang} />
|
||||
) : null}
|
||||
|
||||
<MaxWidth className={styles.blocks} tag="main">
|
||||
<Title>{loyaltyPage.heading}</Title>
|
||||
{loyaltyPage.blocks ? <Blocks blocks={loyaltyPage.blocks} /> : null}
|
||||
</MaxWidth>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
39
components/ContentType/LoyaltyPage/loyaltyPage.module.css
Normal file
39
components/ContentType/LoyaltyPage/loyaltyPage.module.css
Normal file
@@ -0,0 +1,39 @@
|
||||
.content {
|
||||
display: grid;
|
||||
padding-bottom: var(--Spacing-x9);
|
||||
padding-left: var(--Spacing-x0);
|
||||
padding-right: var(--Spacing-x0);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.blocks {
|
||||
display: grid;
|
||||
gap: var(--Spacing-x5);
|
||||
padding-left: var(--Spacing-x2);
|
||||
padding-right: var(--Spacing-x2);
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1367px) {
|
||||
.content {
|
||||
gap: var(--Spacing-x3);
|
||||
padding-left: var(--Spacing-x3);
|
||||
padding-right: var(--Spacing-x3);
|
||||
}
|
||||
|
||||
.content:has(> aside) {
|
||||
grid-template-columns: 360px 1fr;
|
||||
}
|
||||
|
||||
.content:has(> aside) .blocks {
|
||||
grid-column: 2 / -1;
|
||||
}
|
||||
|
||||
.blocks {
|
||||
padding-left: var(--Spacing-x0);
|
||||
padding-right: var(--Spacing-x0);
|
||||
}
|
||||
|
||||
.blocks > section:first-of-type > header {
|
||||
gap: var(--Spacing-x2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user