Skip to content

Commit 523d298

Browse files
committed
refactor: restyle with tailwind
1 parent f48e70c commit 523d298

File tree

11 files changed

+552
-108
lines changed

11 files changed

+552
-108
lines changed

content-script/src/App.css

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

content-script/src/App.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import Logo from "./Logo";
2-
import "./App.css";
32

43
function App() {
54
return (
6-
<div className="App">
7-
<header className="App-header">
8-
<Logo className="App-logo" id="App-logo" title="React logo" />
5+
<div className="w-full text-center">
6+
<header className="bg-gray-800 min-h-screen flex flex-col items-center justify-center text-2xl text-white">
7+
<Logo className="h-40 pointer-events-none animate-spin-slow" id="App-logo" title="React logo" />
98
<p>Hello, World!</p>
109
<p>I'm a Chrome Extension Content Script!</p>
1110
</header>

content-script/src/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
15
body {
26
margin: 0;
37
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',

content-script/src/main.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
11
import React from "react";
22
import { createRoot } from "react-dom/client";
3-
import "./main.css";
3+
import "./main.css";
44
import App from "./App";
55

6-
const body = document.querySelector("body");
7-
86
const app = document.createElement("div");
9-
107
app.id = "root";
118

12-
// Make sure the element that you want to mount the app to has loaded. You can
13-
// also use `append` or insert the app using another method:
14-
// https://developer.mozilla.org/en-US/docs/Web/API/Element#methods
15-
//
16-
// Also control when the content script is injected from the manifest.json:
17-
// https://developer.chrome.com/docs/extensions/mv3/content_scripts/#run_time
18-
if (body) {
19-
body.prepend(app);
20-
}
9+
document.body.prepend(app);
2110

22-
const container = document.getElementById("root");
23-
const root = createRoot(container!);
11+
const root = createRoot(app);
2412

2513
root.render(
2614
<React.StrictMode>

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"@types/react": "^18.0.17",
2020
"@types/react-dom": "^18.0.6",
2121
"@vitejs/plugin-react": "^4.3.1",
22+
"autoprefixer": "^10.4.20",
23+
"postcss": "^8.4.41",
24+
"tailwindcss": "^3.4.9",
2225
"typescript": "^5.5.4",
2326
"vite": "^5.4.0"
2427
}

postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

src/App.css

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

src/App.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import Logo from "./Logo";
2-
import "./App.css";
32

43
function App() {
54
return (
6-
<div className="App">
7-
<header className="App-header">
8-
<Logo className="App-logo" id="App-logo" title="React logo" />
5+
<div className="w-92 text-center">
6+
<header className="bg-gray-800 min-h-screen flex flex-col items-center justify-center text-2xl text-white">
7+
<Logo className="h-40 pointer-events-none animate-spin-slow" id="App-logo" title="React logo" />
98
<p>Hello, World!</p>
109
<p>I'm a Chrome Extension Popup!</p>
1110
</header>

src/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
15
body {
26
margin: 0;
37
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',

tailwind.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
content: [
3+
"./index.html",
4+
"./src/**/*.{js,ts,jsx,tsx}",
5+
"./content-script/src/**/*.{js,ts,jsx,tsx}"
6+
],
7+
theme: {
8+
extend: {},
9+
},
10+
plugins: [],
11+
}

0 commit comments

Comments
 (0)