Skip to content

Commit

Permalink
Update docs (#254)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Nicklas <[email protected]>
  • Loading branch information
Mad-Kat and jantimon authored Jan 10, 2025
1 parent ea744ac commit 0eef024
Show file tree
Hide file tree
Showing 25 changed files with 1,185 additions and 724 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}

on:
workflow_dispatch:
inputs:
pr_number:
description: "Pull Request Number"
required: true
type: string
push:
branches:
- main
Expand All @@ -25,24 +31,26 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.3
run_install: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: "pnpm"

- name: Install node_modules
run: pnpm install

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
Expand All @@ -67,15 +75,15 @@ jobs:
- name: Link Vercel project
run: vercel link --yes --token ${{ secrets.VERCEL_TOKEN }}

# Preview deployment (for pull requests and non-main pushes)
# Preview deployment (for pull requests, manual triggers, and non-main pushes)
- name: Pull Vercel environment information (Preview)
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
run: vercel pull --yes --environment=preview --token ${{ secrets.VERCEL_TOKEN }}
- name: Build project artifacts (Preview)
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
run: vercel build --token ${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel (Preview)
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
run: vercel deploy --prebuilt --token ${{ secrets.VERCEL_TOKEN }}

# Production deployment (for main branch pushes)
Expand All @@ -87,4 +95,4 @@ jobs:
run: vercel build --prod --token ${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel (Production)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: vercel deploy --prebuilt --prod --token ${{ secrets.VERCEL_TOKEN }}
run: vercel deploy --prebuilt --prod --token ${{ secrets.VERCEL_TOKEN }}
281 changes: 228 additions & 53 deletions packages/docs/app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,239 @@
import Link from "next/link";
import { breakpoints, colors, theme } from "@/lib/utils/constants.yak";
import { css, keyframes, styled } from "next-yak";
import NextLink from "next/link";

export default function HomePage() {
return (
<main
style={{
display: "flex",
flexDirection: "column",
textAlign: "center",
justifyContent: "center",
maxWidth: "80ch",
margin: "4rem auto",
}}
>
<img
src="/yak-header.png"
height="1024"
width="1024"
alt="Image of yak coding"
/>
<h1
style={{
fontSize: "2rem",
fontWeight: "bold",
margin: "2rem 0 1rem",
}}
<Article>
<div
css={css`
display: flex;
flex-direction: column-reverse;
${breakpoints.md} {
align-items: last baseline;
flex-direction: row;
gap: 4rem;
}
`}
>
Next-Yak
</h1>
<p>
<Title>Next-Yak</Title>
<Image
src="/img/yak-jumping.png"
height="256"
width="256"
alt="Image of yak coding"
/>
</div>
<Description>
A CSS-in-JS solution tailored for Next.js that seamlessly combines the
expressive power of styled-components syntax with efficient build-time
extraction of CSS using Next.js's built-in CSS configuration.
</p>
<div
style={{
display: "flex",
justifyContent: "center",
gap: "4rem",
marginTop: "2rem",
}}
>
<Link
href={"/docs/getting-started"}
style={{
textUnderlineOffset: "2px",
textDecoration: "underline",
}}
>
</Description>
<LinkArea>
<PrimaryLink href={"/docs/getting-started"}>
Get started
</Link>
<Link
href={"https://github.com/jantimon/next-yak"}
style={{
textUnderlineOffset: "2px",
textDecoration: "underline",
}}
>
<Svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M14 4.1 12 6" />
<path d="m5.1 8-2.9-.8" />
<path d="m6 12-1.9 2" />
<path d="M7.2 2.2 8 5.1" />
<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" />
</Svg>
</PrimaryLink>
<SecondaryLink href={"https://github.com/jantimon/next-yak"}>
Github
</Link>
</div>
</main>
<Svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="m9 18 6-6-6-6" />
</Svg>
</SecondaryLink>
</LinkArea>

<Subtitle>Features</Subtitle>
<List>
<li>
<EnumTitle>NextJs Compatibility</EnumTitle>
Works smoothly with both React Server and Client Components
</li>
<li>
<EnumTitle>Build-time CSS</EnumTitle>
Reduces load time by handling CSS during the build phase, using
Next.js built-in CSS Modules features
</li>
<li>
<EnumTitle>Lightweight Runtime</EnumTitle>
Operates with minimal impact, simply changing CSS classes without
modifying the CSSOM
</li>
<li>
<EnumTitle>Standard CSS Syntax</EnumTitle>
Write styles in familiar, easy-to-use CSS
</li>
<li>
<EnumTitle>Integrates with Atomic CSS</EnumTitle>
Easily combines with atomic CSS frameworks like Tailwind CSS for more
design options
</li>
<li>
<EnumTitle>No significant build-time overhead</EnumTitle>
Doesn't increase the build time significantly, by only transforming
statically as much as possible without the need to evaluate arbitrary
JavaScript.
</li>
</List>
<video
src="https://github.com/jantimon/next-yak/assets/4113649/f5a220fc-2a0f-46be-a8e7-c855f7faa337"
controls
/>
</Article>
);
}

const Article = styled.article`
display: flex;
flex-direction: column;
justify-content: center;
max-width: 80ch;
margin-inline: auto;
padding: 2rem 1rem;
`;

const Title = styled.h1`
font-size: 5rem;
font-weight: 400;
background: #000;
background: radial-gradient(
circle farthest-corner at top left,
#000 0%,
#333 100%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
${theme.dark} {
background: #fff;
background: radial-gradient(
circle farthest-corner at top left,
#ffffff 0%,
#cccccc 100%
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
`;

const Image = styled.img`
${breakpoints.md} {
transform: scaleX(-1);
}
`;

const Description = styled.p`
margin-block-end: 2rem;
${breakpoints.md} {
margin-block: 1.5rem;
}
`;

const LinkArea = styled.div`
display: flex;
justify-content: center;
gap: 4rem;
`;

const clickScale = keyframes`
from {
transform: scale(1);
}
to {
transform: scale(0.8);
}
`;

const PrimaryLink = styled(NextLink)`
display: inline-flex;
align-items: center;
border-radius: 12px;
padding: 8px;
padding-inline-start: 16px;
${colors.primary};
&:hover svg {
animation: ${clickScale} 0.3s alternate;
animation-timing-function: linear(
0,
0.351 9%,
0.626 18.3%,
0.832 28.1%,
0.909 33.2%,
0.971 38.5%,
1.013 43.3%,
1.043 48.4%,
1.062 53.8%,
1.07 59.5%,
1.063 68.8%,
1.011 90.3%,
1
);
}
`;

const SecondaryLink = styled(NextLink)`
display: inline-flex;
align-items: center;
border-radius: 12px;
padding: 8px;
padding-inline-start: 16px;
${colors.secondary};
&:hover svg {
transform: translateX(4px);
transition: transform 0.15s ease-in-out;
}
`;

const Subtitle = styled.h2`
font-size: 2rem;
font-weight: 400;
margin: 2rem 0 1rem;
text-align: left;
`;

const List = styled.ul`
list-style-type: disc;
margin-left: 2rem;
margin-bottom: 2rem;
& li {
margin-bottom: 1rem;
}
`;

const EnumTitle = styled.div`
font-weight: 600;
`;

const Svg = styled.svg`
height: 0.7lh;
`;
2 changes: 2 additions & 0 deletions packages/docs/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default async function Page(props: {
components={{
...defaultMdxComponents,
Popup,
// @ts-expect-error - As long as fumadocs didn't update to react 19, this is necessary
PopupContent,
// @ts-expect-error - As long as fumadocs didn't update to react 19, this is necessary
PopupTrigger,
Tabs,
Tab,
Expand Down
7 changes: 0 additions & 7 deletions packages/docs/app/docs/global.css

This file was deleted.

1 change: 0 additions & 1 deletion packages/docs/app/docs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { ReactNode } from "react";
import { baseOptions } from "@/app/layout.config";
import { source } from "@/lib/source";
import "fumadocs-twoslash/twoslash.css";
import "./global.css";

export default function Layout({ children }: { children: ReactNode }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/app/layout.config.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { YakLogo } from "@/components/lazyYakIcon";
import { YakLogo } from "@/components/yakIcon";
import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";

/**
Expand Down
Loading

0 comments on commit 0eef024

Please sign in to comment.