mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: format with prettier
This commit is contained in:
parent
03fb09c3d6
commit
a147ad6610
164 changed files with 11257 additions and 8154 deletions
|
|
@ -1,13 +1,7 @@
|
|||
"use client";
|
||||
'use client'
|
||||
|
||||
function ClientComponentSkeleton({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<div>{children}</div>
|
||||
)
|
||||
function ClientComponentSkeleton({ children }: { children: React.ReactNode }) {
|
||||
return <div>{children}</div>
|
||||
}
|
||||
|
||||
export default ClientComponentSkeleton
|
||||
export default ClientComponentSkeleton
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
'use client'
|
||||
|
||||
'use client';
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { useServerInsertedHTML } from 'next/navigation';
|
||||
import { ServerStyleSheet, StyleSheetManager } from 'styled-components';
|
||||
import React, { useState } from 'react'
|
||||
import { useServerInsertedHTML } from 'next/navigation'
|
||||
import { ServerStyleSheet, StyleSheetManager } from 'styled-components'
|
||||
|
||||
export default function StyledComponentsRegistry({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
// Only create stylesheet once with lazy initial state
|
||||
// x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
|
||||
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet());
|
||||
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet())
|
||||
|
||||
useServerInsertedHTML(() => {
|
||||
const styles = styledComponentsStyleSheet.getStyleElement();
|
||||
styledComponentsStyleSheet.instance.clearTag();
|
||||
return <>{styles}</>;
|
||||
});
|
||||
const styles = styledComponentsStyleSheet.getStyleElement()
|
||||
styledComponentsStyleSheet.instance.clearTag()
|
||||
return <>{styles}</>
|
||||
})
|
||||
|
||||
if (typeof window !== 'undefined') return <>{children}</>;
|
||||
if (typeof window !== 'undefined') return <>{children}</>
|
||||
|
||||
return (
|
||||
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>
|
||||
{children as React.ReactChild}
|
||||
</StyleSheetManager>
|
||||
);
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue