Skip to content

Commit d9d790b

Browse files
authored
Merge pull request #1 from wctiger/feature/shadcn
Feature/shadcn
2 parents cf77158 + 4af8389 commit d9d790b

31 files changed

+2828
-1848
lines changed

package-lock.json

Lines changed: 1700 additions & 1139 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,38 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@ant-design/icons": "^5.6.1",
14-
"@ctrl/tinycolor": "^4.1.0",
13+
"@radix-ui/react-popover": "^1.1.14",
14+
"@radix-ui/react-progress": "^1.1.7",
15+
"@radix-ui/react-slot": "^1.2.3",
1516
"@types/lodash": "^4.17.16",
16-
"antd": "^5.24.4",
1717
"axios": "^1.8.3",
18+
"class-variance-authority": "^0.7.1",
19+
"clsx": "^2.1.1",
20+
"cmdk": "^1.1.1",
1821
"lodash": "^4.17.21",
22+
"lucide-react": "^0.513.0",
1923
"react": "^19.0.0",
2024
"react-dom": "^19.0.0",
21-
"semver": "^7.7.1"
25+
"semver": "^7.7.1",
26+
"tailwind-merge": "^3.3.0"
2227
},
2328
"devDependencies": {
2429
"@eslint/js": "^9.21.0",
30+
"@tailwindcss/postcss": "^4.1.8",
31+
"@tailwindcss/typography": "^0.5.16",
32+
"@tailwindcss/vite": "^4.1.8",
33+
"@types/node": "^24.0.0",
2534
"@types/react": "^19.0.10",
2635
"@types/react-dom": "^19.0.4",
2736
"@types/semver": "^7.5.8",
2837
"@vitejs/plugin-react": "^4.3.4",
38+
"autoprefixer": "^10.4.21",
2939
"eslint": "^9.21.0",
3040
"eslint-plugin-react-hooks": "^5.1.0",
3141
"eslint-plugin-react-refresh": "^0.4.19",
3242
"globals": "^16.2.0",
43+
"postcss": "^8.5.4",
44+
"tailwindcss": "^4.1.8",
3345
"typescript": "^5.8.3",
3446
"typescript-eslint": "^8.24.1",
3547
"vite": "^6.2.0"

src/App.css

Lines changed: 0 additions & 154 deletions
This file was deleted.

src/App.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import React, { useEffect } from "react";
2-
import { ThemeProvider } from "./contexts/ThemeContext";
3-
import AntdProvider from "./contexts/AntdProvider";
42
import AppLayout from "./components/AppLayout";
53
import SearchBox from "./components/SearchBox";
64
import PackageResults from "./components/PackageResults";
75
import ErrorDisplay from "./components/ErrorDisplay";
86
import { usePackageSearch } from "./hooks/usePackageSearch";
97
import { useSearchParams } from "./hooks/useSearchParams";
10-
import "./App.css";
118

129
const AppContent: React.FC = () => {
1310
// URL params state management
@@ -111,13 +108,7 @@ const AppContent: React.FC = () => {
111108
};
112109

113110
const App: React.FC = () => {
114-
return (
115-
<ThemeProvider>
116-
<AntdProvider>
117-
<AppContent />
118-
</AntdProvider>
119-
</ThemeProvider>
120-
);
111+
return <AppContent />;
121112
};
122113

123114
export default App;

src/components/AppLayout.tsx

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,51 @@
11
import React from "react";
2-
import { Layout, Typography, Button } from "antd";
3-
import { GithubOutlined } from "@ant-design/icons";
2+
import { Button } from "@/components/ui/button";
3+
import { Github } from "lucide-react";
44
import ThemeToggle from "./ThemeToggle";
55

6-
const { Header, Content, Footer } = Layout;
7-
const { Link } = Typography;
8-
96
interface AppLayoutProps {
107
children: React.ReactNode;
118
onLogoClick: () => void;
129
}
1310

1411
const AppLayout: React.FC<AppLayoutProps> = ({ children, onLogoClick }) => {
1512
return (
16-
<Layout style={{ width: "100%", minHeight: "100vh" }}>
17-
<Header className="app-header">
18-
<Link
19-
className="app-logo"
13+
<div className="min-h-screen w-full flex flex-col bg-white dark:bg-gray-900">
14+
<header className="flex items-center justify-between px-6 py-4 bg-green-700 text-white">
15+
<button
2016
onClick={onLogoClick}
21-
style={{ color: "white", cursor: "pointer" }}
17+
className="text-xl font-bold text-white hover:text-green-200 cursor-pointer bg-transparent border-none"
2218
>
2319
NPM Version Popularity
24-
</Link>
20+
</button>
2521
<ThemeToggle />
26-
</Header>
27-
<Content className="app-content">
28-
<div className="app-container">{children}</div>
29-
</Content>
30-
<Footer className="app-footer">
31-
<div className="footer-content">
32-
<span>NPM Version Popularity ©{new Date().getFullYear()}</span>
33-
<Button
34-
type="link"
35-
href="https://github.com/wctiger/npm-version-popularity"
36-
target="_blank"
37-
rel="noopener noreferrer"
38-
style={{ fontSize: "14px" }}
39-
icon={<GithubOutlined />}
40-
aria-label="View on GitHub"
41-
>
42-
View on GitHub
22+
</header>
23+
24+
<main className="flex-1 p-6 w-full">
25+
<div className="max-w-7xl w-full mx-auto px-6 text-gray-900 dark:text-gray-100">
26+
{children}
27+
</div>
28+
</main>
29+
30+
<footer className="text-center w-full py-6 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800">
31+
<div className="flex justify-center items-center gap-4">
32+
<span className="text-sm text-gray-600 dark:text-gray-400">
33+
NPM Version Popularity ©{new Date().getFullYear()}
34+
</span>
35+
<Button variant="link" size="sm" asChild className="text-sm">
36+
<a
37+
href="https://github.com/wctiger/npm-version-popularity"
38+
target="_blank"
39+
rel="noopener noreferrer"
40+
className="flex items-center gap-2 text-green-700 dark:text-green-500"
41+
>
42+
<Github className="h-4 w-4" />
43+
View on GitHub
44+
</a>
4345
</Button>
4446
</div>
45-
</Footer>
46-
</Layout>
47+
</footer>
48+
</div>
4749
);
4850
};
4951

src/components/ErrorDisplay.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
2-
import { Alert, Button, Space } from "antd";
3-
import { ReloadOutlined } from "@ant-design/icons";
2+
import { Button } from "@/components/ui/button";
3+
import { Card, CardContent } from "@/components/ui/card";
4+
import { AlertCircle, RotateCcw } from "lucide-react";
45

56
interface ErrorDisplayProps {
67
errorMessage: string;
@@ -12,19 +13,23 @@ const ErrorDisplay: React.FC<ErrorDisplayProps> = ({
1213
onReset,
1314
}) => {
1415
return (
15-
<Space direction="vertical" style={{ width: "100%", marginTop: "24px" }}>
16-
<Alert
17-
message="Error"
18-
description={errorMessage}
19-
type="error"
20-
showIcon
21-
action={
22-
<Button icon={<ReloadOutlined />} size="small" onClick={onReset}>
23-
Clear
24-
</Button>
25-
}
26-
/>
27-
</Space>
16+
<div className="flex justify-center items-center min-h-[200px] w-full">
17+
<Card className="w-full max-w-md">
18+
<CardContent className="p-6">
19+
<div className="flex flex-col items-center text-center space-y-4">
20+
<div className="flex items-center space-x-2 text-destructive">
21+
<AlertCircle className="h-5 w-5" />
22+
<span className="font-medium">Error</span>
23+
</div>
24+
<p className="text-sm text-muted-foreground">{errorMessage}</p>
25+
<Button onClick={onReset} variant="outline" className="mt-4">
26+
<RotateCcw className="h-4 w-4 mr-2" />
27+
Try Again
28+
</Button>
29+
</div>
30+
</CardContent>
31+
</Card>
32+
</div>
2833
);
2934
};
3035

0 commit comments

Comments
 (0)