Skip to content

Commit

Permalink
refactor: use tailwind utils for theme change
Browse files Browse the repository at this point in the history
  • Loading branch information
משה וילנר committed Nov 11, 2024
1 parent e548cfc commit c050dbb
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
4 changes: 1 addition & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
</body>
<script type="module" src="/src/index.tsx"></script>
Expand Down
4 changes: 1 addition & 3 deletions src/Layout/Footer/Footer.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
footer {
background: var(--primary-color);
color: #fefefe;
footer {
padding: 1.2em;
}
footer a:visited {
Expand Down
2 changes: 1 addition & 1 deletion src/Layout/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./Footer.css";
export default function Footer() {
return (
<footer>
<footer className="bg-primary text-secondary">
made by{" "}
<a
href="https://gs500coder.blogspot.com"
Expand Down
14 changes: 14 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ body,
}
:root {
--primary-color: #04aa6d;
--secondary: #fefefe;
--header-footer-bg-color: #04aa6d;
--header-footer-font-color: #fff;
--secondary-color: #333;
--secondary-text-color: #333;
--font-color: #000;
--bg-color: #fff;
--secondary-bg-color: #eee;

}
[data-theme="light"] {
--primary: #04aa6d;
--secondary: #fefefe;
}
[data-theme="dark"] {
--primary: #9a97f3;
--secondary: #fefefe;
--primary-color: #9a97f3;
--header-footer-bg-color: #9a97f3;
--header-footer-font-color: #fff;
Expand All @@ -32,6 +40,12 @@ body,
--bg-color: #161625;
--secondary-bg-color: #818cab;
}
.light{
--primary: #04aa6d;
}
.dark{
--primary: #9a97f3;
}
.MainWrap {
flex: 1;
display: flex;
Expand Down
12 changes: 11 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
/** @type {import('tailwindcss').Config} */
const colors = require("tailwindcss/colors");
export default {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
darkMode: ["selector", '[data-mode="dark"]'],
theme: {
extend: {
colors: {},
colors: {
...colors,
primary: {
DEFAULT: "var(--primary)",
},
secondary: {
DEFAULT: "var(--secondary)",
},
},
},
},
plugins: [],
Expand Down

0 comments on commit c050dbb

Please sign in to comment.