Skip to content

Commit

Permalink
fix: nextra & panda styles conflicting
Browse files Browse the repository at this point in the history
  • Loading branch information
lvandernoll committed Nov 11, 2024
1 parent 5b6d64a commit a362656
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dev": "next dev",
"build": "next build",
"build:ci": "pnpm generate && pnpm build",
"postinstall": "node ./scripts/nextra-css-layer.mjs",
"postbuild": "next-sitemap",
"start": "next start",
"generate": "pnpm generate:embeddings",
Expand Down
1 change: 1 addition & 0 deletions panda.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default defineBeamUiConfig({
'./**/*.{ts,tsx}',
'./pages/**/*.mdx',
],
preflight: false,
layers: {
reset: 'beam-reset',
base: 'beam-base',
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions scripts/nextra-css-layer.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as fs from 'node:fs';

const filename = './node_modules/nextra-theme-docs/dist/style.css';

fs.readFile(filename, 'utf8', (err, data) => {
if (err) {
// biome-ignore lint/suspicious/noConsoleLog: Allowed in script
console.log(err);
return;
}

if (data.includes('@layer nextra')) {
return;
}

const newContent = `
@layer nextra {
${data}
}
`;

fs.writeFile(filename, newContent, 'utf8', (err) => {
if (err) {
// biome-ignore lint/suspicious/noConsoleLog: Allowed in script
console.log(err);
}
});
});
2 changes: 2 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ html {
}

body {
/* Reset body width in order to support radix modal's scroll-lock */
width: unset !important;
background: linear-gradient(
to bottom,
rgba(255, 255, 255, 0) 0%,
Expand Down
11 changes: 7 additions & 4 deletions theme.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,20 @@ const config: DocsThemeConfig = {
);
},
footer: {
content: () => {
component: () => {
const open = useGTMStore((store) => store.openConsentModal);

return (
<div
<footer
className={hstack({
align: 'center',
gap: '4',
px: '4',
pb: '4',
py: '4',
color: 'mono.100',
bg: 'mono.650',
borderTop: '1px solid',
borderColor: 'mono.550',
})}
>
<span className={text({ style: 'sm' })}>
Expand All @@ -89,7 +92,7 @@ const config: DocsThemeConfig = {
>
cookies
</Link>
</div>
</footer>
);
},
},
Expand Down

0 comments on commit a362656

Please sign in to comment.