diff --git a/docs-ui/src/components/Theming/index.tsx b/docs-ui/src/components/Theming/index.tsx index d06f51348b..f47e86306a 100644 --- a/docs-ui/src/components/Theming/index.tsx +++ b/docs-ui/src/components/Theming/index.tsx @@ -1,11 +1,16 @@ -import { MDXRemote } from 'next-mdx-remote-client/rsc'; -import { formattedMDXComponents } from '@/mdx-components'; -import type { - ComponentDefinition, - DataAttributeValues, -} from '../../../../packages/ui/src/types'; +'use client'; -export function Theming({ definition }: { definition: ComponentDefinition }) { +import { formattedMDXComponents } from '@/mdx-components'; +import type { DataAttributeValues } from '../../../../packages/ui/src/types'; + +interface ThemingProps { + definition: { + classNames: Record; + dataAttributes?: Record; + }; +} + +export function Theming({ definition }: ThemingProps) { const classNames = definition.classNames; const dataAttributes = definition.dataAttributes; @@ -33,15 +38,28 @@ export function Theming({ definition }: { definition: ComponentDefinition }) { ...Object.values(classNames).slice(1), ]; + // Use the same styled components from MDX + const H2 = formattedMDXComponents.h2!; + const P = formattedMDXComponents.p!; + const Ul = formattedMDXComponents.ul!; + const Li = formattedMDXComponents.li!; + const Code = formattedMDXComponents.code!; + return ( - `- \`${selector}\``).join('\n')} - `} - /> +
+

Theming

+

+ Our theming system is based on a mix between CSS classes, CSS variables + and data attributes. If you want to customise this component, you can + use one of these class names below. +

+
    + {classNamesArray.map((selector, index) => ( +
  • + {selector} +
  • + ))} +
+
); } diff --git a/docs-ui/src/utils/definitions.ts b/docs-ui/src/utils/definitions.ts index d279d73775..452a519980 100644 --- a/docs-ui/src/utils/definitions.ts +++ b/docs-ui/src/utils/definitions.ts @@ -1 +1,12 @@ +'use client'; + +/** + * Client-side re-export of UI component definitions. + * + * The 'use client' directive here creates a boundary that prevents Next.js + * from analyzing the transitive dependencies (hooks) during SSR/SSG. + * + * This allows the UI package to remain pure and free of Next.js-specific + * directives while still working correctly in the Next.js App Router. + */ export * from '../../../packages/ui/src/definitions';