Skip to content

Commit 64e4f5b

Browse files
committed
Update project name to 'npm Version Popularity' across all components
1 parent 113b85e commit 64e4f5b

File tree

4 files changed

+45
-8
lines changed

4 files changed

+45
-8
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React + TS</title>
7+
<title>NPM Version Checker</title>
88
</head>
99
<body>
1010
<div id="root"></div>

src/App.tsx

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from "react";
2-
import { Layout, ConfigProvider, theme } from "antd";
2+
import { Layout, ConfigProvider, theme, Typography } from "antd";
33
import { ThemeProvider, useTheme } from "./contexts/ThemeContext";
44
import SearchBox from "./components/SearchBox";
55
import PackageResults from "./components/PackageResults";
@@ -10,6 +10,10 @@ import "./App.css";
1010

1111
const { Header, Content, Footer } = Layout;
1212
const { defaultAlgorithm, darkAlgorithm } = theme;
13+
const { Link } = Typography;
14+
15+
// Define a vibrant primary color
16+
const primaryColor = "#238636"; // GitHub green
1317

1418
const AppContent: React.FC = () => {
1519
const { isDarkTheme } = useTheme();
@@ -21,11 +25,19 @@ const AppContent: React.FC = () => {
2125
error,
2226
packageInfo,
2327
hasSearched,
28+
resetSearch,
2429
} = usePackageSearch();
2530

2631
// State for version filter
2732
const [versionFilter, setVersionFilter] = useState("");
2833

34+
// Handle logo click to reset the app to home state
35+
const handleLogoClick = () => {
36+
resetSearch();
37+
setSearchTerm("");
38+
setVersionFilter("");
39+
};
40+
2941
const renderContent = () => {
3042
if (error) {
3143
return (
@@ -55,18 +67,33 @@ const AppContent: React.FC = () => {
5567
<ConfigProvider
5668
theme={{
5769
algorithm: isDarkTheme ? darkAlgorithm : defaultAlgorithm,
70+
token: {
71+
colorPrimary: primaryColor,
72+
},
5873
components: {
5974
Layout: {
6075
bodyBg: isDarkTheme ? "#000000" : "#f5f5f5",
61-
headerBg: isDarkTheme ? "#141414" : "#001529",
76+
headerBg: isDarkTheme ? "#141414" : "#24292F",
6277
footerBg: isDarkTheme ? "#141414" : "#f0f2f5",
6378
},
79+
Button: {
80+
colorPrimaryHover: isDarkTheme ? "#2EA043" : "#2EA043",
81+
},
82+
Progress: {
83+
colorInfo: primaryColor,
84+
},
6485
},
6586
}}
6687
>
6788
<Layout style={{ width: "100%", minHeight: "100vh" }}>
6889
<Header className="app-header">
69-
<div className="app-logo">NPM Version Checker</div>
90+
<Link
91+
className="app-logo"
92+
onClick={handleLogoClick}
93+
style={{ color: "white", cursor: "pointer" }}
94+
>
95+
NPM Version Popularity
96+
</Link>
7097
<ThemeToggle />
7198
</Header>
7299
<Content className="app-content">
@@ -83,8 +110,7 @@ const AppContent: React.FC = () => {
83110
</div>
84111
</Content>
85112
<Footer className="app-footer">
86-
NPM Version Popularity Checker ©{new Date().getFullYear()} Created
87-
with Ant Design
113+
NPM Version Popularity ©{new Date().getFullYear()}
88114
</Footer>
89115
</Layout>
90116
</ConfigProvider>

src/components/PackageResults.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const PackageResults: React.FC<PackageResultsProps> = ({
118118
dataIndex: "version",
119119
key: "version",
120120
render: (version) => (
121-
<Tag color="blue" style={{ margin: 0 }}>
121+
<Tag color="green" style={{ margin: 0 }}>
122122
{version}
123123
</Tag>
124124
),

src/hooks/usePackageSearch.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,21 @@ export const usePackageSearch = () => {
5656
}
5757
};
5858

59+
// Reset the search state to default values
60+
const resetSearch = () => {
61+
setState({
62+
loading: false,
63+
error: null,
64+
packageInfo: null,
65+
hasSearched: false,
66+
});
67+
};
68+
5969
return {
6070
searchTerm,
6171
setSearchTerm,
6272
searchPackage,
73+
resetSearch,
6374
loading: state.loading,
6475
error: state.error,
6576
packageInfo: state.packageInfo,

0 commit comments

Comments
 (0)