|
1 | | -import Link from "next/link"; |
| 1 | +import { breakpoints, colors, theme } from "@/lib/utils/constants.yak"; |
| 2 | +import { css, keyframes, styled } from "next-yak"; |
| 3 | +import NextLink from "next/link"; |
2 | 4 |
|
3 | 5 | export default function HomePage() { |
4 | 6 | return ( |
5 | | - <main |
6 | | - style={{ |
7 | | - display: "flex", |
8 | | - flexDirection: "column", |
9 | | - textAlign: "center", |
10 | | - justifyContent: "center", |
11 | | - maxWidth: "80ch", |
12 | | - margin: "4rem auto", |
13 | | - }} |
14 | | - > |
15 | | - <img |
16 | | - src="/yak-header.png" |
17 | | - height="1024" |
18 | | - width="1024" |
19 | | - alt="Image of yak coding" |
20 | | - /> |
21 | | - <h1 |
22 | | - style={{ |
23 | | - fontSize: "2rem", |
24 | | - fontWeight: "bold", |
25 | | - margin: "2rem 0 1rem", |
26 | | - }} |
| 7 | + <Article> |
| 8 | + <div |
| 9 | + css={css` |
| 10 | + display: flex; |
| 11 | + flex-direction: column-reverse; |
| 12 | +
|
| 13 | + ${breakpoints.md} { |
| 14 | + align-items: last baseline; |
| 15 | + flex-direction: row; |
| 16 | + gap: 4rem; |
| 17 | + } |
| 18 | + `} |
27 | 19 | > |
28 | | - Next-Yak |
29 | | - </h1> |
30 | | - <p> |
| 20 | + <Title>Next-Yak</Title> |
| 21 | + <Image |
| 22 | + src="/img/yak-jumping.png" |
| 23 | + height="256" |
| 24 | + width="256" |
| 25 | + alt="Image of yak coding" |
| 26 | + /> |
| 27 | + </div> |
| 28 | + <Description> |
31 | 29 | A CSS-in-JS solution tailored for Next.js that seamlessly combines the |
32 | 30 | expressive power of styled-components syntax with efficient build-time |
33 | 31 | extraction of CSS using Next.js's built-in CSS configuration. |
34 | | - </p> |
35 | | - <div |
36 | | - style={{ |
37 | | - display: "flex", |
38 | | - justifyContent: "center", |
39 | | - gap: "4rem", |
40 | | - marginTop: "2rem", |
41 | | - }} |
42 | | - > |
43 | | - <Link |
44 | | - href={"/docs/getting-started"} |
45 | | - style={{ |
46 | | - textUnderlineOffset: "2px", |
47 | | - textDecoration: "underline", |
48 | | - }} |
49 | | - > |
| 32 | + </Description> |
| 33 | + <LinkArea> |
| 34 | + <PrimaryLink href={"/docs/getting-started"}> |
50 | 35 | Get started |
51 | | - </Link> |
52 | | - <Link |
53 | | - href={"https://github.com/jantimon/next-yak"} |
54 | | - style={{ |
55 | | - textUnderlineOffset: "2px", |
56 | | - textDecoration: "underline", |
57 | | - }} |
58 | | - > |
| 36 | + <Svg |
| 37 | + xmlns="http://www.w3.org/2000/svg" |
| 38 | + width="24" |
| 39 | + height="24" |
| 40 | + viewBox="0 0 24 24" |
| 41 | + fill="none" |
| 42 | + stroke="currentColor" |
| 43 | + strokeWidth="2" |
| 44 | + strokeLinecap="round" |
| 45 | + strokeLinejoin="round" |
| 46 | + > |
| 47 | + <path d="M14 4.1 12 6" /> |
| 48 | + <path d="m5.1 8-2.9-.8" /> |
| 49 | + <path d="m6 12-1.9 2" /> |
| 50 | + <path d="M7.2 2.2 8 5.1" /> |
| 51 | + <path d="M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z" /> |
| 52 | + </Svg> |
| 53 | + </PrimaryLink> |
| 54 | + <SecondaryLink href={"https://github.com/jantimon/next-yak"}> |
59 | 55 | Github |
60 | | - </Link> |
61 | | - </div> |
62 | | - </main> |
| 56 | + <Svg |
| 57 | + xmlns="http://www.w3.org/2000/svg" |
| 58 | + width="24" |
| 59 | + height="24" |
| 60 | + viewBox="0 0 24 24" |
| 61 | + fill="none" |
| 62 | + stroke="currentColor" |
| 63 | + strokeWidth="2" |
| 64 | + strokeLinecap="round" |
| 65 | + strokeLinejoin="round" |
| 66 | + > |
| 67 | + <path d="m9 18 6-6-6-6" /> |
| 68 | + </Svg> |
| 69 | + </SecondaryLink> |
| 70 | + </LinkArea> |
| 71 | + |
| 72 | + <Subtitle>Features</Subtitle> |
| 73 | + <List> |
| 74 | + <li> |
| 75 | + <EnumTitle>NextJs Compatibility</EnumTitle> |
| 76 | + Works smoothly with both React Server and Client Components |
| 77 | + </li> |
| 78 | + <li> |
| 79 | + <EnumTitle>Build-time CSS</EnumTitle> |
| 80 | + Reduces load time by handling CSS during the build phase, using |
| 81 | + Next.js built-in CSS Modules features |
| 82 | + </li> |
| 83 | + <li> |
| 84 | + <EnumTitle>Lightweight Runtime</EnumTitle> |
| 85 | + Operates with minimal impact, simply changing CSS classes without |
| 86 | + modifying the CSSOM |
| 87 | + </li> |
| 88 | + <li> |
| 89 | + <EnumTitle>Standard CSS Syntax</EnumTitle> |
| 90 | + Write styles in familiar, easy-to-use CSS |
| 91 | + </li> |
| 92 | + <li> |
| 93 | + <EnumTitle>Integrates with Atomic CSS</EnumTitle> |
| 94 | + Easily combines with atomic CSS frameworks like Tailwind CSS for more |
| 95 | + design options |
| 96 | + </li> |
| 97 | + <li> |
| 98 | + <EnumTitle>No significant build-time overhead</EnumTitle> |
| 99 | + Doesn't increase the build time significantly, by only transforming |
| 100 | + statically as much as possible without the need to evaluate arbitrary |
| 101 | + JavaScript. |
| 102 | + </li> |
| 103 | + </List> |
| 104 | + <video |
| 105 | + src="https://github.com/jantimon/next-yak/assets/4113649/f5a220fc-2a0f-46be-a8e7-c855f7faa337" |
| 106 | + controls |
| 107 | + /> |
| 108 | + </Article> |
63 | 109 | ); |
64 | 110 | } |
| 111 | + |
| 112 | +const Article = styled.article` |
| 113 | + display: flex; |
| 114 | + flex-direction: column; |
| 115 | + justify-content: center; |
| 116 | + max-width: 80ch; |
| 117 | + margin-inline: auto; |
| 118 | + padding: 2rem 1rem; |
| 119 | +`; |
| 120 | + |
| 121 | +const Title = styled.h1` |
| 122 | + font-size: 5rem; |
| 123 | + font-weight: 400; |
| 124 | +
|
| 125 | + background: #000; |
| 126 | + background: radial-gradient( |
| 127 | + circle farthest-corner at top left, |
| 128 | + #000 0%, |
| 129 | + #333 100% |
| 130 | + ); |
| 131 | + -webkit-background-clip: text; |
| 132 | + -webkit-text-fill-color: transparent; |
| 133 | +
|
| 134 | + ${theme.dark} { |
| 135 | + background: #fff; |
| 136 | + background: radial-gradient( |
| 137 | + circle farthest-corner at top left, |
| 138 | + #ffffff 0%, |
| 139 | + #cccccc 100% |
| 140 | + ); |
| 141 | + -webkit-background-clip: text; |
| 142 | + -webkit-text-fill-color: transparent; |
| 143 | + } |
| 144 | +`; |
| 145 | + |
| 146 | +const Image = styled.img` |
| 147 | + ${breakpoints.md} { |
| 148 | + transform: scaleX(-1); |
| 149 | + } |
| 150 | +`; |
| 151 | + |
| 152 | +const Description = styled.p` |
| 153 | + margin-block-end: 2rem; |
| 154 | + ${breakpoints.md} { |
| 155 | + margin-block: 1.5rem; |
| 156 | + } |
| 157 | +`; |
| 158 | + |
| 159 | +const LinkArea = styled.div` |
| 160 | + display: flex; |
| 161 | + justify-content: center; |
| 162 | + gap: 4rem; |
| 163 | +`; |
| 164 | + |
| 165 | +const clickScale = keyframes` |
| 166 | + from { |
| 167 | + transform: scale(1); |
| 168 | + } |
| 169 | + to { |
| 170 | + transform: scale(0.8); |
| 171 | + } |
| 172 | +`; |
| 173 | + |
| 174 | +const PrimaryLink = styled(NextLink)` |
| 175 | + display: inline-flex; |
| 176 | + align-items: center; |
| 177 | + border-radius: 12px; |
| 178 | + padding: 8px; |
| 179 | + padding-inline-start: 16px; |
| 180 | + ${colors.primary}; |
| 181 | +
|
| 182 | + &:hover svg { |
| 183 | + animation: ${clickScale} 0.3s alternate; |
| 184 | + animation-timing-function: linear( |
| 185 | + 0, |
| 186 | + 0.351 9%, |
| 187 | + 0.626 18.3%, |
| 188 | + 0.832 28.1%, |
| 189 | + 0.909 33.2%, |
| 190 | + 0.971 38.5%, |
| 191 | + 1.013 43.3%, |
| 192 | + 1.043 48.4%, |
| 193 | + 1.062 53.8%, |
| 194 | + 1.07 59.5%, |
| 195 | + 1.063 68.8%, |
| 196 | + 1.011 90.3%, |
| 197 | + 1 |
| 198 | + ); |
| 199 | + } |
| 200 | +`; |
| 201 | + |
| 202 | +const SecondaryLink = styled(NextLink)` |
| 203 | + display: inline-flex; |
| 204 | + align-items: center; |
| 205 | + border-radius: 12px; |
| 206 | + padding: 8px; |
| 207 | + padding-inline-start: 16px; |
| 208 | + ${colors.secondary}; |
| 209 | +
|
| 210 | + &:hover svg { |
| 211 | + transform: translateX(4px); |
| 212 | + transition: transform 0.15s ease-in-out; |
| 213 | + } |
| 214 | +`; |
| 215 | + |
| 216 | +const Subtitle = styled.h2` |
| 217 | + font-size: 2rem; |
| 218 | + font-weight: 400; |
| 219 | + margin: 2rem 0 1rem; |
| 220 | + text-align: left; |
| 221 | +`; |
| 222 | + |
| 223 | +const List = styled.ul` |
| 224 | + list-style-type: disc; |
| 225 | + margin-left: 2rem; |
| 226 | + margin-bottom: 2rem; |
| 227 | +
|
| 228 | + & li { |
| 229 | + margin-bottom: 1rem; |
| 230 | + } |
| 231 | +`; |
| 232 | + |
| 233 | +const EnumTitle = styled.div` |
| 234 | + font-weight: 600; |
| 235 | +`; |
| 236 | + |
| 237 | +const Svg = styled.svg` |
| 238 | + height: 0.7lh; |
| 239 | +`; |
0 commit comments