Skip to content

Commit

Permalink
💄 add root background style
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnsonMao committed Nov 1, 2023
1 parent c087bdc commit 6f39742
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export async function generateMetadata(): Promise<Metadata> {
function HtmlLayout({ children }: React.PropsWithChildren) {
return (
<Html>
<body className="body-bg dark:body-bg-dark">
<body>
<div className="root-background fixed inset-0 -z-50"></div>
<Providers>{children}</Providers>
</body>
</Html>
Expand Down
33 changes: 18 additions & 15 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,32 @@ const tailwindcssConfig = {
},
plugins: [
require('@tailwindcss/typography'),
plugin(({ addUtilities }) => {
addUtilities({
'.body-bg': {
'--color': 'rgba(0, 0, 0, 0.1)',
plugin(({ addComponents, theme }) => {
addComponents({
'.root-background': {
'--base-color': theme('colors.zinc.100'),
'--line-color': 'rgba(0, 0, 0, 0.04)',
background: `
linear-gradient(
to left,
var(--color) 0,
var(--color) 1px,
transparent 1px,
transparent 10px
var(--line-color) 0,
var(--line-color) 10%,
transparent 10%,
transparent 100%
),
linear-gradient(
to top,
var(--color) 0,
var(--color) 1px,
transparent 1px,
transparent 10px
);`,
var(--line-color) 0,
var(--line-color) 10%,
transparent 10%,
transparent 100%
),
var(--base-color);`,
backgroundSize: '10px 10px;'
},
'.body-bg-dark': {
'--color': 'rgba(255, 255, 255, 0.05)',
'.dark .root-background': {
'--base-color': theme('colors.zinc.900'),
'--line-color': 'rgba(255, 255, 255, 0.04)',
}
})
})
Expand Down

0 comments on commit 6f39742

Please sign in to comment.