Skip to content

Commit d34743f

Browse files
v.0.3.5 - New previews & Dropdown Menu Category (#59)
* 🚧 started an intern cli to easily create new component or categories * 🐛 update component rendering logic with createElement * ✨ add Mac OS dropdown menu component and update related configurations * 🔥 remove old preview images logic * ✨ add new category previews * 📝 add previews & dropdown changelogs * 📝 update last changelog date, modify tsconfig exclude list, and add avatars preview to categories
1 parent f3aad97 commit d34743f

File tree

237 files changed

+3211
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+3211
-217
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

apps/website/src/app/(site)/[section]/page.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ export default function Page({ params }: Readonly<Props>) {
5555
description={category.description}
5656
title={category.name}
5757
>
58-
<MainMenuCardContent
59-
sectionSlug={section.slug}
60-
category={category}
61-
/>
58+
<MainMenuCardContent category={category} />
6259
</MainMenusGradientCard>
6360
</Link>
6461
);

apps/website/src/app/card.tsx

+29-21
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,48 @@
1-
import Image from "next/image";
21
import type {
32
CategoryType,
43
SingleComponentCategoryType,
54
} from "@cuicui/ui/lib/types/component";
5+
import { categoriesPreviewsList } from "@/categories-previews-list";
6+
import { createElement } from "react";
7+
import { HourglassIcon } from "lucide-react";
68

79
export const MainMenuCardContent = ({
810
category,
9-
sectionSlug,
1011
}: {
1112
category: CategoryType | SingleComponentCategoryType;
12-
sectionSlug: string;
1313
}) => {
1414
if (category?.comingSoonCategory) {
1515
return (
16-
<p className="-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 font-semibold text-2xl text-neutral-800 dark:text-neutral-300">
17-
Coming Soon
16+
<p className="size-full grid place-content-center">
17+
<div className="w-fit p-4 bg-neutral-400/15 rounded-xl gap-2 flex items-center justify-center text-neutral-400">
18+
{/* Hourglass Icon */}
19+
<HourglassIcon className="size-6 " />
20+
<p className="text-2xl font-semibold">Coming Soon</p>
21+
</div>
1822
</p>
1923
);
2024
}
2125

26+
const Component = getCategoryPreviewComponent(category.slug);
27+
28+
if (Component) {
29+
return (
30+
<div className="flex items-center justify-center size-full gap-2 py-4 px-12">
31+
{createElement(Component, { category })}
32+
</div>
33+
);
34+
}
35+
2236
return (
23-
<>
24-
<Image
25-
alt={`${category.name} preview`}
26-
className="h-48 w-full object-cover hidden dark:block"
27-
height={400}
28-
src={`/preview-images/dark-${sectionSlug}-${category.slug}.png`}
29-
width={600}
30-
/>
31-
<Image
32-
alt={`${category.name} preview`}
33-
className="h-48 w-full object-cover dark:hidden"
34-
height={400}
35-
src={`/preview-images/light-${sectionSlug}-${category.slug}.png`}
36-
width={600}
37-
/>
38-
</>
37+
<div className="flex items-center justify-center size-full gap-2 py-4 px-12">
38+
<p>Preview is missing</p>
39+
</div>
3940
);
4041
};
42+
43+
const getCategoryPreviewComponent = (slug: string) => {
44+
const Component = Object.keys(categoriesPreviewsList).find(
45+
(key) => key === slug,
46+
) as keyof typeof categoriesPreviewsList;
47+
return Component ? categoriesPreviewsList[Component] : null;
48+
};

apps/website/src/app/dev/generate-preview-images/generate-preview-images.tsx

-133
This file was deleted.

apps/website/src/app/dev/generate-preview-images/page.tsx

-15
This file was deleted.

apps/website/src/app/dev/page.tsx

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1-
import Modern3dKbdVariant1 from "@/cuicui/application-ui/kbd/modern-3d-kbd/variant1";
2-
import React from "react";
1+
"use client";
32

4-
export default function Page() {
5-
return <Modern3dKbdVariant1 />;
3+
export default function MacOSDropdownMenu() {
4+
return (
5+
<div
6+
style={{
7+
backgroundImage:
8+
"url('https://static1.squarespace.com/static/5e949a92e17d55230cd1d44f/t/6667b379b716e7212d986a57/1718072191450/Seq3x2.png?format=1500w')",
9+
10+
backgroundSize: "cover",
11+
backgroundPosition: "center",
12+
backgroundRepeat: "no-repeat",
13+
}}
14+
className="w-full h-dvh p-10"
15+
>
16+
<div className="rounded-[6px] min-w-32 text-sm p-1 text-white bg-[rgba(30,30,31,0.5)] backdrop-blur-xl shadow-[0px_20px_30px_0px_rgba(0,0,0,0.25),0px_0px_15px_0px_rgba(0,0,0,0.1),inset_0px_0px_0px_1px_rgba(255,255,255,0.075),0px_0px_0px_1px_rgba(0,0,0,0.5)] w-fit">
17+
<p className="truncate cursor-pointer whitespace-nowrap py-0.5 text-white/90 px-1.5 hover:bg-blue-600 rounded-[4px]">
18+
Refresh
19+
</p>
20+
</div>
21+
</div>
22+
);
623
}

apps/website/src/app/preview/[section]/[category]/[component]/[variant]/page.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { SectionsList } from "@cuicui/ui/lib/sections-list";
22
import type { Metadata } from "next";
33
import { notFound } from "next/navigation";
4+
import { createElement } from "react";
45

56
export const metadata: Metadata = {
67
referrer: "no-referrer",
@@ -52,7 +53,7 @@ export default function PagePreview({
5253
return (
5354
<div className="grid place-content-center w-full min-h-screen">
5455
{typeof variantFound.component === "function"
55-
? variantFound.component()
56+
? createElement(variantFound.component)
5657
: variantFound.component}
5758
</div>
5859
);

apps/website/src/app/preview/[section]/[category]/[component]/page.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { findCorrespondingComponent } from "#/src/app/preview/[section]/[categor
22
import { SectionsList } from "@cuicui/ui/lib/sections-list";
33
import type { Metadata } from "next";
44
import { notFound } from "next/navigation";
5+
import { createElement } from "react";
56

67
export const metadata: Metadata = {
78
referrer: "no-referrer",
@@ -55,7 +56,7 @@ export default function PagePreview({
5556
return (
5657
<div className="grid place-content-center w-full h-screen overflow-auto">
5758
{typeof variantFound.component === "function"
58-
? variantFound.component()
59+
? createElement(variantFound.component)
5960
: variantFound.component}
6061
</div>
6162
);
+12
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// This file is generated by the generate-latest-changelog-date script
2-
export const lastChangelogDate = new Date("2024-11-21T23:00:00.000Z");
2+
export const lastChangelogDate = new Date("2024-11-23T23:00:00.000Z");

apps/website/src/components/component-wrapper/component-tab-renderer.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from "#/src/ui/shadcn/scrollarea";
2222
import { cn } from "#/src/utils/cn";
2323
import { getContainerHeightClass } from "#/src/components/component-wrapper/get-container-height-class";
24+
import { createElement } from "react";
2425
const tabs = [
2526
{
2627
name: "Preview",
@@ -93,7 +94,7 @@ export default function ComponentTabRenderer({
9394
}
9495
})}
9596
</Tabs.List>
96-
<Tabs.Content value="preview" asChild>
97+
<Tabs.Content value="preview" asChild={true}>
9798
{isResizable ? (
9899
<ResizablePanelGroup
99100
className={cn(
@@ -119,7 +120,7 @@ export default function ComponentTabRenderer({
119120
// key={render}
120121
>
121122
{typeof component === "function"
122-
? component()
123+
? createElement(component)
123124
: (component ?? <p>An error has occured</p>)}
124125
</ComponentWrapper>
125126
</ResizablePanel>
@@ -139,7 +140,7 @@ export default function ComponentTabRenderer({
139140
// key={render}
140141
>
141142
{typeof component === "function"
142-
? component()
143+
? createElement(component)
143144
: (component ?? <p>An error has occured</p>)}
144145
</ComponentWrapper>
145146
)}

apps/website/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
"strict": true,
2626
"target": "es5"
2727
},
28-
"exclude": ["node_modules"],
28+
"exclude": ["node_modules, .next"],
2929
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"]
3030
}

packages/internal-cli/.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.yml]
11+
indent_style = space
12+
indent_size = 2

packages/internal-cli/.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

packages/internal-cli/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

0 commit comments

Comments
 (0)