Skip to content

Commit

Permalink
V0.3.1 (#53)
Browse files Browse the repository at this point in the history
* ✨ Add magnetic button 🧲

* 🐛 iframe before effect button

* 🚚 move vscode settings to root

* ✨ add variants to search

* 🔍 add title to website links

* 🎨 simplify text effects and improve button imports

* ➖ clean up package dependencies

* ✨ introduce changelog using mdx

* ✨ add brand new UI and new github button component

* ✅ Update with new component and new menu
  • Loading branch information
damien-schneider authored Nov 9, 2024
1 parent abbbcd2 commit b9d520e
Show file tree
Hide file tree
Showing 35 changed files with 2,107 additions and 1,900 deletions.
File renamed without changes.
File renamed without changes.
26 changes: 20 additions & 6 deletions apps/website/__mocks__/globals-mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,34 @@ import { vi } from "vitest";

// Mock implementation of ResizeObserver
const ResizeObserverMock = vi.fn(() => ({
observe: vi.fn(),
unobserve: vi.fn(),
disconnect: vi.fn(),
observe: vi.fn(),
unobserve: vi.fn(),
disconnect: vi.fn(),
}));

// Stub the global ResizeObserver with the mock
vi.stubGlobal("ResizeObserver", ResizeObserverMock);

// Example: Mock implementation of window.fetch
const fetchMock = vi.fn(() =>
Promise.resolve({
json: () => Promise.resolve({}),
}),
Promise.resolve({
json: () => Promise.resolve({}),
}),
);

// Stub the global fetch with the mock
vi.stubGlobal("fetch", fetchMock);

Object.defineProperty(window, "matchMedia", {
writable: true,
value: vi.fn().mockImplementation((query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(), // Deprecated
removeListener: vi.fn(), // Deprecated
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});
5 changes: 2 additions & 3 deletions apps/website/__tests__/sidemenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ describe("Sidemenu component", () => {
</div>,
);

it("should have href attribute of the 'Contribute' element set to https://cuicui.featurebase.app/", () => {
it("should have href attribute of the 'Contribute' element set to https://github.com/damien-schneider/cuicui", () => {
const contributeElement = screen.getByTestId("navigation-link-Contribute");

// Check if the href attribute of the 'Contribute' element is https://cuicui.featurebase.app/
const hrefValue = contributeElement.getAttribute("href");
expect(hrefValue).toBe("https://cuicui.featurebase.app/");
expect(hrefValue).toBe("https://github.com/damien-schneider/cuicui");
});
it("should have href attribute of the 'Getting started' element to finish by getting-started", () => {
const contributeElement = screen.getByTestId(
Expand Down
2 changes: 1 addition & 1 deletion apps/website/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const nextConfig = {
// experimental: {
// serverComponentsExternalPackages: ["shiki", "vscode-oniguruma"],
// },
transpilePackages: ["shiki"],
transpilePackages: ["shiki", "next-mdx-remote"],
images: {
remotePatterns: [
{
Expand Down
12 changes: 1 addition & 11 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,32 @@
"url": "https://github.com/damien-schneider"
},
"dependencies": {
"@ctrl/tinycolor": "4.1.0",
"@cuicui/ui": "workspace:*",
"@radix-ui/react-dialog": "1.1.1",
"@radix-ui/react-dropdown-menu": "2.1.1",
"@radix-ui/react-scroll-area": "1.1.0",
"@radix-ui/react-select": "2.0.0",
"@radix-ui/react-slider": "1.2.0",
"@radix-ui/react-slot": "1.1.0",
"@radix-ui/react-tabs": "1.1.0",
"@radix-ui/react-tooltip": "1.1.2",
"@uiw/react-signature": "1.3.1",
"bezier-editor": "1.0.1",
"class-variance-authority": "0.7.0",
"clsx": "2.1.0",
"cmdk": "1.0.0",
"date-fns": "3.6.0",
"dom-to-image-more": "3.4.5",
"embla-carousel-react": "8.2.1",
"framer-motion": "11.2.10",
"fs-extra": "11.2.0",
"get-similar-color": "1.1.4",
"jsbarcode": "3.11.6",
"lucide-react": "0.427.0",
"next": "14.2.3",
"next-mdx-remote": "5.0.0",
"next-themes": "0.3.0",
"path": "0.12.7",
"qrcode.react": "4.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-frame-component": "5.2.7",
"react-resizable-panels": "2.0.22",
"sharp": "0.33.4",
"sonner": "1.5.0",
"tailwind-merge": "2.3.0",
"tts-react": "3.0.7",
"vaul": "0.9.1",
"vite-tsconfig-paths": "5.0.1",
"zustand": "4.5.4"
},
Expand Down
114 changes: 114 additions & 0 deletions apps/website/src/app/(components)/changelog/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import {
eachDayOfInterval,
format,
formatDistanceToNow,
formatISO,
parseISO,
} from "date-fns";

import { compileMDX, type CompileMDXResult } from "next-mdx-remote/rsc";
import { promises as fs } from "node:fs";
import path from "node:path";

interface Frontmatter {
title: string;
}

export default async function ProjectPage() {
const filenames = await fs.readdir(
path.join(process.cwd(), "src/changelogs"),
);

// const rangeOfAllDays = eachDayOfInterval({
// start: new Date(2024, 10, 1), // 1st November 2024 (no changelogs before that)
// end: new Date(), // Today
// });

const contentMap: { date: Date; content: string }[] = [];

for (const file of filenames) {
const isoDate = parseISO(file.replace(/\.mdx$/, ""));
// const IsoDate = formatISO(date, { representation: "date" });

const filePath = path.join(process.cwd(), `src/changelogs/${file}`);
try {
const content = await fs.readFile(filePath, "utf-8");
contentMap.push({ date: isoDate, content });
} catch (error) {
// @ts-ignore
if (error.code === "ENOENT") {
console.log(`No changelog found for ${file}`);
// Continue without throwing the error
} else {
// For other errors, you might still want to handle them
console.error(`Error reading file ${filePath}:`, error);
throw error; // Re-throw if it's a different kind of error
}
}
}

const finalContentMap: { data: CompileMDXResult<Frontmatter>; date: Date }[] =
[];

for (const content of contentMap) {
const data = await compileMDX<Frontmatter>({
source: content,
options: {
parseFrontmatter: true,
},
components: {
// Your Components here
},
});
finalContentMap.push({ data, date: content.date });
console.log(data.content);
console.log(data.frontmatter);
}

const changelogs = await Promise.all(
filenames.map(async (filename) => {
const content = await fs.readFile(
path.join(process.cwd(), "src/changelogs", filename),
"utf-8",
);
const { frontmatter, content: contentMDX } =
await compileMDX<Frontmatter>({
source: content,
options: {
parseFrontmatter: true,
},
});
return {
filename,
filenameWithoutExtension: filename.replace(".mdx", ""),
content: contentMDX,
date: parseISO(filename.replace(".mdx", "")),
...frontmatter,
};
}),
);

return (
<div className="cuicui-default-style">
<h1>Changelog</h1>
<section className="space-y-12">
{changelogs.map(({ content, date, title }) => {
return (
<article
key={date.toISOString()}
className="[&_ul]:text-neutral-600 [&_ul]:dark:text-neutral-400"
>
<h5 className="m-0">{format(date, "do MMMM yyyy")}</h5>
<p className="text-neutral-500 tracking-tight text-sm">
{formatDistanceToNow(date, { addSuffix: true })}
</p>
<span className=" bg-neutral-400/30 w-full h-px inline-flex m-0" />
<h4 className="text-2xl">{title}</h4>
{content}
</article>
);
})}
</section>
</div>
);
}
55 changes: 6 additions & 49 deletions apps/website/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,65 +19,22 @@ export default function HomePage() {
className=" scale-50 "
/>
</div>
<div className="rotate-3 absolute top-0 -right-[10%] mt-20 ">
<div className="rotate-3 absolute top-0 -right-[10%] mt-20 hidden sm:block">
<PreviewRecursiveTree />
</div>

<div className="max-w-lg xl:max-w-xl mx-auto lg:mb-0 text-center relative pb-20 px-8">
<div className="flex mb-6 items-center justify-center">
<TextEffectWrapper
className="block ml-2 font-medium lg:text-xl"
as="span"
preset="slide"
per="word"
delay={0.8}
>
Cuicui
</TextEffectWrapper>
</div>
<div className="flex mb-6 items-center justify-center">Cuicui</div>
<h1 className="text-4xl md:text-5xl lg:text-7xl tracking-tight">
<TextEffectWrapper
className="block"
as="span"
preset="blur"
per="word"
delay={0.1}
>
Every UI
</TextEffectWrapper>
<TextEffectWrapper
className="block text-balance"
as="span"
preset="blur"
per="word"
delay={0.3}
>
components, hooks, tools, ...
</TextEffectWrapper>
<TextEffectWrapper
className="block"
as="h1"
preset="blur"
per="word"
delay={0.5}
>
you need
</TextEffectWrapper>
Every UI components, hooks, tools, ... you need
</h1>
<TextEffectWrapper
className="text-lg dark:text-neutral-300 text-neutral-600 mt-10 mb-10"
as="p"
preset="blur"
per="word"
delay={0.7}
>
<p className="m-4">
More than 100 variants of Open-Source components, hooks and tools made
for React. Just Copy Paste.
</TextEffectWrapper>

</p>
<Link
href="/common-ui"
className=" font-medium text-xl px-6 py-2 rounded-2xl dark:text-neutral-300 text-neutral-700 bg-neutral-100 dark:hover:bg-neutral-800 hover:bg-neutral-200 transition hover:scale-105 dark:bg-neutral-900 border border-neutral-400/15"
className="inline-flex mt-4 font-medium text-xl px-6 py-2 rounded-2xl dark:text-neutral-300 text-neutral-700 bg-neutral-100 dark:hover:bg-neutral-800 hover:bg-neutral-200 dark:bg-neutral-900 border border-neutral-400/15"
>
Start Copy Pasting
</Link>
Expand Down
28 changes: 28 additions & 0 deletions apps/website/src/changelogs/2024-11-09.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: New UI, Search and Changelog
---

#### New component

- Magnetic background button and magnetic button
- Markdown component to render markdown content server site and client side easily with next-mdx-remote
- Github Stars Button which now replace the old one on the site

#### Website modifications


##### Brand new design

With the new Github Star Button and a much cleaner Gradient Container, the website has a new look and feel. The new design is more modern and more aligned with the Cuicui brand.
The badges have also been updated to be more consistent with the new design.

##### New features

- Introduce the [changelog](/changelog) page to list most of the changelogs
- Remove the update tags as the changelog page would be the main source of truth
- Add components to search results and redefined the section and categories which would result in a better search experience


##### SEO

- Add title to most of the website links
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function GithubEditButton({
// Example : https://github.com/damien-schneider/cuicui/tree/main/src/ui/cuicui/other/creative-effects/animated-noise
href={`${CUICUI_GITHUB_URL}/tree/main/packages/ui/cuicui/${sectionSlug}/${categorySlug}/${componentSlug ? componentSlug : ""}`}
className="text-sm text-neutral-500 hover:text-neutral-500/50 hover:underline font-medium tracking-tight"
title={`Edit ${componentSlug ?? categorySlug} on Github`}
>
Edit on Github
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function CuicuiFloatingDock() {
>
<Link
href={CUICUI_GITHUB_URL}
title="Damien Schneider GitHub"
className={cn(
"group relative h-14 w-10 ml-2 overflow-hidden rounded-full bg-neutral-50 dark:bg-neutral-900 p-2 border border-neutral-500/20",
"hover:scale-110 transform-gpu transition-transform duration-150",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const FloatingDockMobile = ({
<Link
href={item.href}
key={item.title}
title={item.title}
className={cn(
"rounded-full w-fit px-4 py-4 bg-neutral-50 border border-neutral-400/20 flex items-center justify-center gap-2",
pathname.includes(item.href)
Expand Down Expand Up @@ -213,7 +214,7 @@ function IconContainer({
const [hovered, setHovered] = useState(false);

return (
<Link href={href}>
<Link href={href} title={title}>
<motion.div
ref={ref}
style={{ width, height }}
Expand Down
4 changes: 2 additions & 2 deletions apps/website/src/components/navigation/desktop-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export function DesktopSideMenu({
</Link>
</div>
<StarGithubProjectButton />
<SearchMenu />
</div>
<InfoMenuList />
<ScrollArea className="w-full h-full mt-4">
<ScrollAreaViewport className="h-full">
<NavigationMenu />
</ScrollAreaViewport>
</ScrollArea>
<Byline className="w-full" />
<SearchMenu className="mb-2" />
<Byline />
</div>
);
}
Loading

0 comments on commit b9d520e

Please sign in to comment.