Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/app/api/design/overview/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { NextResponse } from "next/server";

export async function GET() {
// Basic static data; future implementation can dynamically analyze codebase
const data = {
colors: [
"beige",
"dark-beige",
"dark-blue",
"light-blue",
"navy-blue",
"github-blue",
"github-green",
"aurora",
"blossom",
"meadow",
"sunset",
],
typography: {
fonts: ["Inter var", "Lexend", "Gooper", "Figtree", "Crimson Text"],
},
uiElements: [
"Button",
"FormField",
"DataTable",
"DropdownMenu",
"Table",
"AnimatedShinyText",
"BorderBeam",
"DotPattern",
"FlickeringGrid",
"Meteors",
],
};

return NextResponse.json(data);
}
3 changes: 3 additions & 0 deletions src/app/dashboard/[org]/[repo]/design/Design.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons";

import DesignOverview from "./DesignOverview";

interface DesignProps {
org: string;
repo: string;
Expand All @@ -18,6 +20,7 @@ const DesignComponent: React.FC<DesignProps> = ({ org, repo }) => {
</h2>
</div>
<div className="space-y-6 rounded-lg border border-gray-200 bg-white p-4 shadow-sm transition-colors dark:border-gray-700 dark:bg-gray-800 sm:p-6">
<DesignOverview org={org} repo={repo} />
<div>
<h3 className="text-lg font-semibold text-gray-900 transition-colors dark:text-white sm:text-xl">
Transform Your Figma Designs into React Components
Expand Down
75 changes: 75 additions & 0 deletions src/app/dashboard/[org]/[repo]/design/DesignOverview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React, { useEffect, useState } from "react";

interface DesignOverviewProps {
org: string;
repo: string;
}

const DesignOverview: React.FC<DesignOverviewProps> = ({ org, repo }) => {
const [data, setData] = useState<any>(null);

useEffect(() => {
const fetchData = async () => {
try {
const res = await fetch("/api/design/overview");
if (!res.ok) {
throw new Error("Failed to fetch design overview");
}
const json = await res.json();
setData(json);
} catch (error) {
console.error(error);
}
};

fetchData();
}, [org, repo]);

if (!data) {
return <div>Loading design overview...</div>;
}

return (
<div className="mb-6 space-y-4">
<h3 className="text-lg font-semibold text-gray-900 transition-colors dark:text-white">
Design System Overview
</h3>

<div>
<h4 className="text-md font-semibold text-gray-800 transition-colors dark:text-gray-200">
Colors
</h4>
<ul className="list-disc pl-5 text-sm text-gray-600 transition-colors dark:text-gray-300">
{Array.isArray(data.colors) &&
data.colors.map((color: string) => <li key={color}>{color}</li>)}
</ul>
</div>

<div>
<h4 className="text-md font-semibold text-gray-800 transition-colors dark:text-gray-200">
Typography
</h4>
<p className="text-sm text-gray-600 transition-colors dark:text-gray-300">
Fonts:{" "}
{Array.isArray(data.typography?.fonts)
? data.typography.fonts.join(", ")
: ""}
</p>
</div>

<div>
<h4 className="text-md font-semibold text-gray-800 transition-colors dark:text-gray-200">
Common UI Elements
</h4>
<ul className="list-disc pl-5 text-sm text-gray-600 transition-colors dark:text-gray-300">
{Array.isArray(data.uiElements) &&
data.uiElements.map((element: string) => (
<li key={element}>{element}</li>
))}
</ul>
</div>
</div>
);
};

export default DesignOverview;