feat(guide): sidebar

This commit is contained in:
iCrawl
2023-04-12 00:39:35 +02:00
parent 731ea5f3cb
commit ee907f32f3
12 changed files with 82 additions and 12 deletions

View File

@@ -0,0 +1,16 @@
'use client';
import { Section as DJSSection, type SectionOptions } from '@discordjs/ui';
import type { PropsWithChildren } from 'react';
import { useMedia } from 'react-use';
// This is wrapper around the Section component from @discordjs/ui,
// it simply automatically sets the dense prop to true if the screen
// width is less than 768px. This is done to separate client-side logic
// from server-side rendering.
export function Section(options: PropsWithChildren<SectionOptions>) {
const matches = useMedia('(max-width: 768px)', true);
const modifiedOptions = { ...options, dense: matches };
return <DJSSection {...modifiedOptions} />;
}