diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-04-12 22:14:05 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-04-12 22:14:05 -0700 |
| commit | 8cfa334717481bc2fcfa716b546304924157abff (patch) | |
| tree | c49dc578124991920ebc072be86275b71dee9795 /src/app/registry.tsx | |
| parent | 851d48fbf341e0f9f5f7d734666822976ab06a0e (diff) | |
make windows re-sizeable general lint/formatting
Diffstat (limited to 'src/app/registry.tsx')
| -rw-r--r-- | src/app/registry.tsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/app/registry.tsx b/src/app/registry.tsx new file mode 100644 index 0000000..4a5a4e1 --- /dev/null +++ b/src/app/registry.tsx @@ -0,0 +1,26 @@ +"use client"; +import React, { useState } from "react"; +import { useServerInsertedHTML } from "next/navigation"; +import { ServerStyleSheet, StyleSheetManager } from "styled-components"; + +export default function StyledComponentsRegistry({ + children, +}: { + children: React.ReactNode; +}) { + const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet()); + + useServerInsertedHTML(() => { + const styles = styledComponentsStyleSheet.getStyleElement(); + styledComponentsStyleSheet.instance.clearTag(); + return <>{styles}</>; + }); + + if (typeof window !== "undefined") return <>{children}</>; + + return ( + <StyleSheetManager sheet={styledComponentsStyleSheet.instance}> + {children as React.ReactElement} + </StyleSheetManager> + ); +} |
