-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add styled-components and core components
- Loading branch information
Showing
8 changed files
with
511 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@fortawesome:registry=https://npm.fontawesome.com/ | ||
//npm.fontawesome.com/:_authToken=${FONTAWESOME_NPM_AUTH_TOKEN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import BuilderDevTools from "@builder.io/dev-tools/next"; | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = BuilderDevTools()({}); | ||
const nextConfig = BuilderDevTools()({ compiler: { styledComponents: true } }); | ||
|
||
export default nextConfig; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use client' | ||
|
||
import { ThemeProvider } from 'styled-components' | ||
import { themes } from '@aleph-front/core' | ||
|
||
export default function ClientThemeProvider({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<ThemeProvider theme={themes.aleph}> | ||
{children} | ||
</ThemeProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'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 | ||
}) { | ||
// 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()) | ||
|
||
useServerInsertedHTML(() => { | ||
const styles = styledComponentsStyleSheet.getStyleElement() | ||
styledComponentsStyleSheet.instance.clearTag() | ||
return <>{styles}</> | ||
}) | ||
|
||
if (typeof window !== 'undefined') return <>{children}</> | ||
|
||
return ( | ||
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}> | ||
{children} | ||
</StyleSheetManager> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters