fix: improve conditional Sidebar CSS

This commit is contained in:
Arvid Norlin
2024-05-28 14:32:54 +02:00
parent 49351e4565
commit 9d69f1fe58
2 changed files with 8 additions and 9 deletions

View File

@@ -8,12 +8,11 @@ import styles from "./loyaltyPage.module.css"
export default async function LoyaltyPage() {
const loyaltyPage = await serverClient().contentstack.loyaltyPage.get()
const hasSidebar = !!loyaltyPage.sidebar.length
return (
<section
className={`${styles.content} ${hasSidebar && styles.hasLeftSidebar}`}
>
{hasSidebar && <Sidebar blocks={loyaltyPage.sidebar} />}
<section className={styles.content}>
{loyaltyPage.sidebar.length ? (
<Sidebar blocks={loyaltyPage.sidebar} />
) : null}
<MaxWidth className={styles.blocks} tag="main">
{loyaltyPage.blocks ? <Blocks blocks={loyaltyPage.blocks} /> : null}