diff --git a/apps/guide/src/components/Section.tsx b/apps/guide/src/components/Section.tsx index 075760697..722344864 100644 --- a/apps/guide/src/components/Section.tsx +++ b/apps/guide/src/components/Section.tsx @@ -2,15 +2,7 @@ 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) { - const matches = useMedia('(max-width: 768px)', true); - const modifiedOptions = { ...options, dense: matches }; - - return ; + return ; } diff --git a/apps/guide/src/components/SidebarItems.tsx b/apps/guide/src/components/SidebarItems.tsx deleted file mode 100644 index 72f6e95c6..000000000 --- a/apps/guide/src/components/SidebarItems.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Section } from '@discordjs/ui'; -import type { MDXInstance } from 'astro'; -import { useEffect, useMemo, useState } from 'react'; -import { useLocation } from 'react-use'; - -export type MDXPage = MDXInstance<{ category: string; title: string }>; - -export function SidebarItems({ pages }: { pages: MDXPage[] }) { - const state = useLocation(); - const [active, setActive] = useState(''); - - const categories = useMemo( - () => - pages.reduce>((acc, page) => { - if (acc[page.frontmatter.category]) { - acc[page.frontmatter.category]?.push(page); - } else { - acc[page.frontmatter.category] = [page]; - } - - return acc; - }, {}), - [pages], - ); - - useEffect(() => { - setActive(state.pathname); - }, [state]); - - return Object.keys(categories).map((category, idx) => ( -
- {categories[category]?.map((member, index) => ( - -
- {member.frontmatter.title} -
-
- )) ?? null} -
- )); -} diff --git a/apps/website/src/components/Section.tsx b/apps/website/src/components/Section.tsx index 075760697..722344864 100644 --- a/apps/website/src/components/Section.tsx +++ b/apps/website/src/components/Section.tsx @@ -2,15 +2,7 @@ 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) { - const matches = useMedia('(max-width: 768px)', true); - const modifiedOptions = { ...options, dense: matches }; - - return ; + return ; } diff --git a/packages/ui/src/lib/components/Section.tsx b/packages/ui/src/lib/components/Section.tsx index 0bdd435c5..44adbf5ff 100644 --- a/packages/ui/src/lib/components/Section.tsx +++ b/packages/ui/src/lib/components/Section.tsx @@ -9,7 +9,6 @@ export interface SectionOptions { buttonClassName?: string; className?: string; defaultClosed?: boolean | undefined; - dense?: boolean | undefined; gutter?: boolean | undefined; icon?: JSX.Element | undefined; padded?: boolean | undefined; @@ -20,7 +19,6 @@ export function Section({ title, icon, padded = false, - dense = false, defaultClosed = false, background = false, gutter = false, @@ -55,7 +53,7 @@ export function Section({ className={`${background ? 'bg-light-700 dark:bg-dark-500 rounded' : ''} ${gutter ? 'mt-2' : ''}`} state={disclosure} > - {padded ?
{children}
: children} + {padded ?
{children}
: children} );