Skip to content

Commit

Permalink
Merge pull request #1 from plsankar/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
plsankar authored Dec 26, 2023
2 parents 142c6c4 + 8e9cf17 commit 003938e
Show file tree
Hide file tree
Showing 14 changed files with 407 additions and 17 deletions.
110 changes: 109 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
},
"dependencies": {
"@headlessui/react": "^1.7.15",
"@types/chrome": "^0.0.237",
"color": "^4.2.3",
"lucide-react": "^0.259.0",
"react": "^18.2.0",
"react-copy-to-clipboard": "^5.1.0",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.4.1"
"react-hot-toast": "^2.4.1",
"react-tooltip": "^5.18.0"
},
"devDependencies": {
"@crxjs/vite-plugin": "^2.0.0-beta.18",
Expand Down
36 changes: 36 additions & 0 deletions public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"manifest_version": 3,
"name": "Color Hunter",
"description": "Export the color palette of a website in a single click",
"version": "1.0.0",
"version": "1.0.1",
"icons": {
"16": "dist/icon16.png",
"32": "dist/icon32.png",
"48": "dist/icon48.png",
"128": "dist/icon128.png"
"16": "icon16.png",
"32": "icon32.png",
"48": "icon48.png",
"128": "icon128.png"
},
"action": {
"default_popup": "index.html"
Expand All @@ -24,7 +24,6 @@
],
"permissions": [
"tabs",
"<all_urls>",
"activeTab"
"<all_urls>"
]
}
12 changes: 6 additions & 6 deletions src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import Color from "color";
import { CopyToClipboard } from "react-copy-to-clipboard";
import { getActiveTabId } from "./utils";
import { toast } from "react-hot-toast";
import Header from "./components/Header";
import ErrorPanel from "./components/ErrorPanel";

function App() {
const [colors, setColors] = useState<TColor[]>([]);
Expand All @@ -17,7 +19,7 @@ function App() {
return;
}
if (!activeTab.url?.startsWith("http")) {
setError("Sorry!, This page is not scannable");
setError("Sorry, This page is not scannable");
return;
}
chrome.tabs.sendMessage<EventBlast, ColorScannerResponse>(activeTab.id, { action: "color-scanner" }, function (response) {
Expand Down Expand Up @@ -51,18 +53,16 @@ function App() {
}, []);

return (
<div className="relative flex flex-col">
<div className="sticky top-0 py-5 bg-white border-b shadow-sm">
<h1 className="text-xl text-center">ColorHunter</h1>
</div>
<div className="relative flex flex-col min-h-screen">
<Header />
{colors.length > 0 && (
<div className="flex flex-col gap-5 p-5">
{colors.map((color, index) => (
<ColorItem value={color} key={index} />
))}
</div>
)}
{error && <p className="p-5 text-center rounded">{error}</p>}
{error && <ErrorPanel message={error} />}
</div>
);
}
Expand Down
13 changes: 13 additions & 0 deletions src/ui/components/ErrorPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { FC } from "react";
import WebColors from "../illustrations/WebColors";

const ErrorPanel: FC<{ message: string }> = ({ message }) => {
return (
<div className="flex flex-col items-center justify-center flex-grow gap-5 p-4">
<WebColors />
<p className="text-sm text-center">{message}</p>
</div>
);
};

export default ErrorPanel;
12 changes: 12 additions & 0 deletions src/ui/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import HeaderMenu from "./HeaderMenu";

const Header = () => {
return (
<div className="sticky top-0 flex flex-row items-center w-full gap-4 px-4 py-4 bg-white border-b shadow-sm">
<img src={chrome.runtime.getURL("logo.svg")} alt="ColorHunter" className="inline-block w-40" />
<HeaderMenu />
</div>
);
};

export default Header;
Loading

0 comments on commit 003938e

Please sign in to comment.