Skip to content

Commit 1ec6b90

Browse files
fixed bug where tailwind styling would not be applied to injected content on a tab (#15)
Updating Tailwind stuff.
1 parent ae7e224 commit 1ec6b90

7 files changed

Lines changed: 79 additions & 27 deletions

File tree

entrypoints/background.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export default defineBackground(() => {
2-
console.log('Hello background!', { id: browser.runtime.id });
2+
console.log("Hello background!", { id: browser.runtime.id });
33
});

entrypoints/components/banner.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const Banner = (): React.ReactNode => {
2+
return (
3+
<div className="fixed top-0 left-0 w-full bg-gradient-to-r from-orange-500 to-red-500 text-white p-4 shadow-lg z-50">
4+
<div className="text-center">
5+
<h2 className="text-xl font-bold mb-1">🎓 Degree Audit Plus</h2>
6+
<p className="text-sm opacity-90">
7+
Enhanced degree audit experience - Powered by Longhorn Developers
8+
</p>
9+
</div>
10+
</div>
11+
);
12+
};
13+
14+
export default Banner;

entrypoints/content.ts

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

entrypoints/content.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { createRoot } from "react-dom/client";
2+
import Banner from "./components/banner";
3+
import "./styles/content.css";
4+
5+
export default defineContentScript({
6+
matches: ["https://utdirect.utexas.edu/*"],
7+
main() {
8+
console.log("Content script loaded.");
9+
10+
const container = document.createElement("div");
11+
container.id = "dap-banner-root";
12+
document.body.prepend(container);
13+
14+
const root = createRoot(container);
15+
root.render(<Banner />);
16+
},
17+
});

entrypoints/popup/App.tsx

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,46 @@ function App() {
77
const [count, setCount] = useState(0);
88

99
return (
10-
<>
11-
<div>
12-
<a href="https://wxt.dev" target="_blank">
13-
<img src={wxtLogo} className="logo" alt="WXT logo" />
14-
</a>
15-
<a href="https://react.dev" target="_blank">
16-
<img src={reactLogo} className="logo react" alt="React logo" />
17-
</a>
10+
<div className="min-h-screen bg-gray-100 p-8">
11+
{/* Test Tailwind classes */}
12+
<div className="bg-gradient-to-r from-orange-500 to-red-500 text-white p-4 rounded-lg mb-6">
13+
<h1 className="text-2xl font-bold">🎓 Degree Audit Plus</h1>
14+
<p className="text-sm opacity-90">Enhanced degree audit experience</p>
1815
</div>
19-
<h1>WXT + React</h1>
20-
<div className="card">
21-
<button onClick={() => setCount((count) => count + 1)}>
22-
count is {count}
23-
</button>
24-
<p>
25-
Edit <code>src/App.tsx</code> and save to test HMR
26-
</p>
16+
17+
<div className="bg-white rounded-lg shadow-lg p-6">
18+
<div className="flex justify-center space-x-4 mb-6">
19+
<a
20+
href="https://wxt.dev"
21+
target="_blank"
22+
className="hover:opacity-80 transition-opacity"
23+
>
24+
<img src={wxtLogo} className="h-16 w-16" alt="WXT logo" />
25+
</a>
26+
<a
27+
href="https://react.dev"
28+
target="_blank"
29+
className="hover:opacity-80 transition-opacity"
30+
>
31+
<img src={reactLogo} className="h-16 w-16" alt="React logo" />
32+
</a>
33+
</div>
34+
35+
<div className="text-center">
36+
<button
37+
onClick={() => setCount((count) => count + 1)}
38+
className="bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded-lg transition-colors"
39+
>
40+
count is {count}
41+
</button>
42+
<p className="mt-4 text-gray-600">
43+
Edit{" "}
44+
<code className="bg-gray-200 px-2 py-1 rounded">src/App.tsx</code>{" "}
45+
and save to test HMR
46+
</p>
47+
</div>
2748
</div>
28-
<p className="read-the-docs">
29-
Click on the WXT and React logos to learn more
30-
</p>
31-
</>
49+
</div>
3250
);
3351
}
3452

entrypoints/styles/content.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "tailwindcss";

wxt.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ export default defineConfig({
2323

2424
permissions: ["storage", "tabs", "scripting"],
2525
},
26+
27+
vite: () => ({
28+
css: {
29+
postcss: {
30+
plugins: [require("@tailwindcss/postcss"), require("autoprefixer")],
31+
},
32+
},
33+
}),
2634
});

0 commit comments

Comments
 (0)