This repository was archived by the owner on Apr 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayout.tsx
108 lines (97 loc) · 2.33 KB
/
layout.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { cn } from '@/lib/utils';
import { ThemeProvider } from './theme/theme-provider';
// LAYOUT
// Layout Component
type LayoutProps = {
children: React.ReactNode;
className?: string;
};
const Layout = ({ children, className }: LayoutProps) => {
return (
<html lang="en" className={cn('antialiased scroll-smooth focus:scroll-auto', className)}>
<body className={className}>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
</ThemeProvider>
</body>
</html>
);
};
// Main Component
type MainProps = {
children: React.ReactNode;
className?: string;
id?: string;
};
const Main = ({ children, className, id }: MainProps) => {
return (
<main
className={cn(
// General Prose
'prose prose:font-sans dark:prose-invert md:prose-lg lg:prose-xl max-w-none',
// Prose Headings
'prose-headings:font-normal',
// Inline Links
'prose-a:border-b prose-a:border-b-primary dark:prose-a:border-b-primary prose-a:font-normal prose-a:text-primary dark:prose-a:text-primary hover:prose-a:border-b-primary hover:prose-a:opacity-75 dark:hover:prose-a:border-b-primary prose-a:no-underline prose-a:transition-all',
// Blockquotes
'prose-blockquote:not-italic',
className
)}
id={id}
>
{children}
</main>
);
};
// Section Component
type SectionProps = {
children: React.ReactNode;
className?: string;
id?: string;
};
const Section = ({ children, className, id }: SectionProps) => {
return (
<section className={cn('py-12', className)} id={id}>
{children}
</section>
);
};
// Container Component
type ContainerProps = {
children: React.ReactNode;
className?: string;
id?: string;
};
const Container = ({ children, className, id }: ContainerProps) => {
return (
<div className={cn('max-w-5xl mx-auto', 'p-6 sm:p-8', className)} id={id}>
{children}
</div>
);
};
// Article Component
type ArticleProps = {
children: React.ReactNode;
className?: string;
id?: string;
};
const Article = ({ children, className, id }: ArticleProps) => {
return (
<article
className={cn(
'prose dark:prose-invert md:prose-lg lg:prose-xl',
'prose-headings:font-normal prose-main dark:prose-invert',
className
)}
id={id}
>
{children}
</article>
);
};
export { Layout, Main, Section, Container, Article };