Skip to content

Commit ecda4c2

Browse files
committed
first commit
1 parent 1879da9 commit ecda4c2

27 files changed

+1284
-4470
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ yarn-error.log*
3333
# typescript
3434
*.tsbuildinfo
3535
next-env.d.ts
36+
37+
package-lock.json
38+
/dist

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Webflow Examples
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: app/globals.css

-24
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4-
5-
:root {
6-
--foreground-rgb: 0, 0, 0;
7-
--background-start-rgb: 214, 219, 220;
8-
--background-end-rgb: 255, 255, 255;
9-
}
10-
11-
@media (prefers-color-scheme: dark) {
12-
:root {
13-
--foreground-rgb: 255, 255, 255;
14-
--background-start-rgb: 0, 0, 0;
15-
--background-end-rgb: 0, 0, 0;
16-
}
17-
}
18-
19-
body {
20-
color: rgb(var(--foreground-rgb));
21-
background: linear-gradient(
22-
to bottom,
23-
transparent,
24-
rgb(var(--background-end-rgb))
25-
)
26-
rgb(var(--background-start-rgb));
27-
}

Diff for: app/layout.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import type { Metadata } from 'next'
2-
import { Inter } from 'next/font/google'
3-
import './globals.css'
4-
5-
const inter = Inter({ subsets: ['latin'] })
1+
import "./globals.css";
2+
import type { Metadata } from "next";
3+
import { CategoryProvider } from "@/contexts/Category";
64

75
export const metadata: Metadata = {
8-
title: 'Create Next App',
9-
description: 'Generated by create next app',
10-
}
6+
title: "Quickflow",
7+
description: "Quickly add React components to your Webflow project.",
8+
};
119

1210
export default function RootLayout({
1311
children,
1412
}: {
15-
children: React.ReactNode
13+
children: React.ReactNode;
1614
}) {
1715
return (
1816
<html lang="en">
19-
<body className={inter.className}>{children}</body>
17+
<body className="h-screen w-screen bg bg-webflow-gray flex flex-col items-center justify-center">
18+
<CategoryProvider>{children}</CategoryProvider>
19+
</body>
2020
</html>
21-
)
21+
);
2222
}

Diff for: app/page.tsx

+64-105
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,72 @@
1-
import Image from 'next/image'
1+
"use client";
2+
import React, { useMemo } from "react";
3+
import { Switch } from "@headlessui/react";
4+
import { useRouter } from "next/navigation";
25

3-
export default function Home() {
4-
return (
5-
<main className="flex min-h-screen flex-col items-center justify-between p-24">
6-
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
7-
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
8-
Get started by editing&nbsp;
9-
<code className="font-mono font-bold">app/page.tsx</code>
10-
</p>
11-
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
12-
<a
13-
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
14-
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
15-
target="_blank"
16-
rel="noopener noreferrer"
17-
>
18-
By{' '}
19-
<Image
20-
src="/vercel.svg"
21-
alt="Vercel Logo"
22-
className="dark:invert"
23-
width={100}
24-
height={24}
25-
priority
26-
/>
27-
</a>
28-
</div>
29-
</div>
6+
import { useCategories } from "@/contexts/Category";
307

31-
<div className="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px] z-[-1]">
32-
<Image
33-
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
34-
src="/next.svg"
35-
alt="Next.js Logo"
36-
width={180}
37-
height={37}
38-
priority
39-
/>
40-
</div>
8+
import CategoryToggle from "@/components/CategoryToggle";
9+
import ComponentGrid from "@/components/ComponentGrid";
10+
import { components } from "@/components/quickflow";
4111

42-
<div className="mb-32 grid text-center lg:max-w-5xl lg:w-full lg:mb-0 lg:grid-cols-4 lg:text-left">
43-
<a
44-
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
45-
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
46-
target="_blank"
47-
rel="noopener noreferrer"
48-
>
49-
<h2 className={`mb-3 text-2xl font-semibold`}>
50-
Docs{' '}
51-
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
52-
-&gt;
53-
</span>
54-
</h2>
55-
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
56-
Find in-depth information about Next.js features and API.
57-
</p>
58-
</a>
12+
import { ComponentCategories } from "@/types";
5913

60-
<a
61-
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
62-
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
63-
target="_blank"
64-
rel="noopener noreferrer"
65-
>
66-
<h2 className={`mb-3 text-2xl font-semibold`}>
67-
Learn{' '}
68-
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
69-
-&gt;
70-
</span>
71-
</h2>
72-
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
73-
Learn about Next.js in an interactive course with&nbsp;quizzes!
74-
</p>
75-
</a>
14+
const Page = () => {
15+
const [mounted, setMounted] = React.useState(false);
16+
const { categories, toggleInclude } = useCategories();
17+
const router = useRouter();
7618

77-
<a
78-
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
79-
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
80-
target="_blank"
81-
rel="noopener noreferrer"
82-
>
83-
<h2 className={`mb-3 text-2xl font-semibold`}>
84-
Templates{' '}
85-
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
86-
-&gt;
87-
</span>
88-
</h2>
89-
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
90-
Explore the Next.js 13 playground.
91-
</p>
92-
</a>
19+
const filteredComponents = useMemo(() => {
20+
const result: Partial<ComponentCategories> = {};
21+
Object.entries(categories).forEach(([category, include]) => {
22+
if (include) {
23+
const key = category as keyof ComponentCategories;
24+
result[key] = components[key];
25+
}
26+
});
27+
return result;
28+
}, [categories]);
9329

94-
<a
95-
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
96-
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
97-
target="_blank"
98-
rel="noopener noreferrer"
30+
React.useEffect(() => {
31+
setMounted(true);
32+
}, []);
33+
34+
if (!mounted) {
35+
return null;
36+
}
37+
38+
return (
39+
<div className="flex flex-col items-start relative w-full">
40+
<div className="flex overflow-hidden w-full">
41+
<div
42+
id="sidebar"
43+
className="border-r border-white/20 w-1/4 flex flex-col h-screen"
9944
>
100-
<h2 className={`mb-3 text-2xl font-semibold`}>
101-
Deploy{' '}
102-
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
103-
-&gt;
104-
</span>
105-
</h2>
106-
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
107-
Instantly deploy your Next.js site to a shareable URL with Vercel.
108-
</p>
109-
</a>
45+
<div id="category-toggle" className="m-3">
46+
<span className="text-gray-300">Show components for:</span>
47+
<Switch.Group as="div" className="flex flex-col pt-4">
48+
{Object.entries(categories).map(([category, include]) => {
49+
return (
50+
<CategoryToggle
51+
key={category}
52+
category={category}
53+
include={include}
54+
toggleCategory={() => toggleInclude(category)}
55+
/>
56+
);
57+
})}
58+
</Switch.Group>
59+
</div>
60+
</div>
61+
<div id="main" className="w-3/4 flex flex-col h-full">
62+
<div className="flex-grow overflow-auto">
63+
<ComponentGrid components={filteredComponents} />
64+
</div>
65+
</div>
11066
</div>
111-
</main>
112-
)
113-
}
67+
</div>
68+
);
69+
};
70+
71+
export default Page;
72+

Diff for: components/CategoryToggle.tsx

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
"use client";
2+
import { Switch } from "@headlessui/react";
3+
import { classNames } from "@/utils";
4+
5+
export default function CategoryToggle({
6+
category,
7+
include,
8+
toggleCategory,
9+
}: {
10+
category: string;
11+
include: boolean;
12+
toggleCategory: () => void;
13+
}) {
14+
return (
15+
<div className="flex flex-row mb-2">
16+
<Switch
17+
checked={include}
18+
onChange={toggleCategory}
19+
className={classNames(
20+
include ? "bg-blue-600" : "bg-gray-300",
21+
"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none",
22+
)}
23+
>
24+
<span className="sr-only">Toggle {category}</span>
25+
<span
26+
className={classNames(
27+
include ? "translate-x-5" : "translate-x-0",
28+
"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",
29+
)}
30+
>
31+
<span
32+
className={classNames(
33+
include
34+
? "opacity-0 duration-100 ease-out"
35+
: "opacity-100 duration-200 ease-in",
36+
"absolute inset-0 flex h-full w-full items-center justify-center transition-opacity",
37+
)}
38+
aria-hidden="true"
39+
>
40+
<svg
41+
className="h-3 w-3 text-gray-400"
42+
fill="none"
43+
viewBox="0 0 12 12"
44+
>
45+
<path
46+
d="M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2"
47+
stroke="currentColor"
48+
strokeWidth={2}
49+
strokeLinecap="round"
50+
strokeLinejoin="round"
51+
/>
52+
</svg>
53+
</span>
54+
<span
55+
className={classNames(
56+
include
57+
? "opacity-100 duration-200 ease-in"
58+
: "opacity-0 duration-100 ease-out",
59+
"absolute inset-0 flex h-full w-full items-center justify-center transition-opacity",
60+
)}
61+
aria-hidden="true"
62+
>
63+
<svg
64+
className="h-3 w-3 text-blue-600"
65+
fill="currentColor"
66+
viewBox="0 0 12 12"
67+
>
68+
<path d="M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z" />
69+
</svg>
70+
</span>
71+
</span>
72+
</Switch>
73+
<Switch.Label as="span" className="ml-3 text-sm">
74+
<span className="font-medium text-gray-300 capitalize">{category}</span>
75+
</Switch.Label>
76+
</div>
77+
);
78+
}

0 commit comments

Comments
 (0)