Skip to content

Commit 7f3ebed

Browse files
committed
theme change
changed theme.css and ThemeToggle.jsx for new color and svg changes.
1 parent 4ac5691 commit 7f3ebed

File tree

5 files changed

+97
-71
lines changed

5 files changed

+97
-71
lines changed

package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12+
"@theme-toggles/react": "^4.1.0",
1213
"bootstrap": "^5.3.3",
1314
"react": "^18.3.1",
1415
"react-bootstrap": "^2.10.2",

src/App.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export default function App() {
3030

3131
<div className="tile tile--right tile--cta">
3232
<div className="d-flex flex-column align-items-center text-center">
33-
<div className="mb-2 fw-semibold">Appearance</div>
3433
<ThemeToggle />
3534
</div>
3635
</div>

src/components/ThemeToggle.jsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
import React from "react";
3-
import { Button } from "react-bootstrap";
4-
import useColorMode from "../hooks/useColorMode";
2+
import { Around } from "@theme-toggles/react";
3+
import "@theme-toggles/react/css/Around.css";
54

65
export default function ThemeToggle() {
76
const [mode, setMode] = React.useState(
@@ -13,13 +12,16 @@ export default function ThemeToggle() {
1312
localStorage.setItem("theme", mode);
1413
}, [mode]);
1514

15+
const handleToggle = () => setMode(m => (m === "dark" ? "light" : "dark"));
16+
1617
return (
17-
<Button
18-
variant={mode === "dark" ? "outline-light" : "outline-dark"}
19-
size="sm"
20-
onClick={() => setMode(mode === "dark" ? "light" : "dark")}
21-
>
22-
{mode === "dark" ? "Light mode" : "Dark mode"}
23-
</Button>
18+
<Around
19+
className="theme-toggle"
20+
duration={750}
21+
toggled={mode === "dark"} // true = dark icon state
22+
onToggle={handleToggle}
23+
aria-label="Toggle theme"
24+
title="Toggle theme"
25+
/>
2426
);
2527
}

src/theme.css

Lines changed: 69 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@
2727

2828
--bs-secondary-color: #4b5565;
2929
--bs-secondary-color-rgb: 75, 85, 101;
30-
31-
--github-watermark-fill: %2300000014;
3230
}
3331

3432
/* DARK */
3533
:root[data-bs-theme="dark"] {
3634
--nf-gray-0: #0f1115;
37-
--nf-gray-1: #13161c;
38-
--nf-gray-2: #1a1f27;
39-
--nf-gray-3: #232a35;
40-
--nf-gray-7: #e8e9ee;
35+
--nf-gray-1: #585a5e;
36+
--nf-gray-2: #4c4f55;
37+
--nf-gray-3: #4e5258;
38+
--nf-gray-7: #5d5f69;
4139

4240
--nf-green: #22c55e;
4341
--nf-green-600: #16a34a;
@@ -71,24 +69,30 @@ body { margin: 0; }
7169
min-height: 100vh;
7270
display: flex;
7371
justify-content: center;
72+
padding: 20px;
7473
align-items: center;
75-
padding: 16px;
7674
}
77-
78-
.tile-grid{
79-
display: grid;
80-
gap: 12px;
81-
grid-template-columns: repeat(4, minmax(0, 1fr));
82-
grid-auto-rows: minmax(120px, auto);
83-
width: 100%;
84-
max-width: 1400px;
85-
margin: 0 auto;
86-
grid-auto-flow: dense;
75+
/* Keep the tile grid fixed at 2 columns max and centered */
76+
.tile-grid {
77+
display: grid;
78+
gap: 12px;
79+
grid-template-columns: repeat(2, minmax(0, 1fr)); /* fixed 2 columns */
80+
grid-auto-rows: minmax(120px, auto);
81+
width: 100%;
82+
max-width: 760px; /* same as your 2-col breakpoint width */
83+
margin: 0 auto; /* center the grid */
84+
justify-content: center; /* keep tiles centered horizontally */
85+
grid-auto-flow: dense;
8786
}
88-
@media (max-width: 1199.98px){ .tile-grid{ grid-template-columns: repeat(3, 1fr); max-width: 1000px; } }
89-
@media (max-width: 991.98px){ .tile-grid{ grid-template-columns: repeat(2, 1fr); max-width: 760px; } }
90-
@media (max-width: 575.98px){ .tile-grid{ grid-template-columns: 1fr; max-width: 560px; } }
9187

88+
89+
/* Responsive: single column for narrow screens */
90+
@media (max-width: 575.98px) {
91+
.tile-grid {
92+
grid-template-columns: 1fr;
93+
max-width: 560px;
94+
}
95+
}
9296
/* Base tile */
9397
.tile{
9498
background: var(--bs-tertiary-bg);
@@ -105,28 +109,20 @@ body { margin: 0; }
105109
}
106110
.tile:hover{ transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0,0,0,.28); }
107111

108-
/* CTA arrow bubble for ALL tiles (apply .tile--cta) */
109-
.tile--cta::after{
110-
content: "";
111-
position: absolute;
112-
top: 12px; right: 12px;
113-
width: 34px; height: 34px;
114-
border-radius: 999px;
115-
background: var(--nf-gray-7);
116-
box-shadow: 0 2px 6px rgba(0,0,0,.25);
117-
}
112+
/* CTA arrow (bubble removed; arrow retained) */
113+
.tile--cta::after{ content: none !important; display: none !important; }
118114
.tile--cta::before{
119115
content: "";
120116
position: absolute;
121-
top: 12px; right: 12px;
117+
top: 12px; right: 15px;
122118
width: 34px; height: 34px;
123119
border-radius: 999px;
124120
display: grid; place-items: center;
125121
background:
126122
url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 17L17 7M17 7H9M17 7v8' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
127123
center/18px 18px no-repeat;
124+
filter: invert(1);
128125
}
129-
:root[data-bs-theme="dark"] .tile--cta::before{ filter: invert(1); }
130126

131127
.tile--cta:hover{
132128
border-color: color-mix(in oklab, var(--nf-green) 60%, transparent);
@@ -143,40 +139,19 @@ body { margin: 0; }
143139

144140
.tile--right{ align-items: center; justify-content: center; }
145141

146-
/* Buttons inside tiles */
147142
.tile .btn{ padding: .35rem .75rem; }
148143

149-
/* =========================
150-
Hero / Blurb scale
151-
========================= */
152-
.hero-title{
153-
font-weight: 700;
154-
font-size: clamp(1.4rem, 2.5vw + .6rem, 2.2rem);
155-
line-height: 1.25;
156-
margin-bottom: .6rem;
157-
}
158-
.hero-copy{ opacity:.9; max-width:52ch; }
159-
.hero-blurb{
160-
font-size: clamp(0.9rem, 1vw + 0.2rem, 1.05rem);
161-
color: var(--bs-secondary-color);
162-
font-weight: 400;
163-
max-width: 65ch;
164-
line-height: 1.5;
165-
opacity: 0.95;
166-
}
167-
168144
/* =========================
169145
GitHub Tile — solid + watermark (no gradient)
170146
========================= */
171147
.tile--github{
172148
position: relative;
173-
border: none;
149+
border: 1px solid var(--bs-card-border-color);
174150
border-radius: 16px;
175-
background-color: #1b1f23 !important; /* always dark to match brand */
176151
color: #fff !important;
177152
overflow: hidden;
178153
box-shadow: 0 8px 20px rgba(0,0,0,.35);
179-
transition: transform .2s ease, box-shadow .2s ease;
154+
transition: transform .2s ease, box-shadow .2s ease, border-color .15s ease;
180155
}
181156
.tile--github:hover{ transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0,0,0,.35); }
182157

@@ -190,9 +165,43 @@ body { margin: 0; }
190165
opacity:.22;
191166
z-index:0;
192167
}
193-
.tile--github .tile-content,
194-
.tile--github .tile-icon{ position: relative; z-index: 1; }
168+
.tile--github .tile-content, .tile--github .tile-icon{ position: relative; z-index: 1; }
169+
170+
/* =========================
171+
Tile Overrides
172+
========================= */
173+
.tile { background: #000 !important; border-color: #000 !important; color: #fff; }
174+
.tile a { color: inherit; }
175+
.tile .tile-icon { color: inherit; }
195176

196-
/* Arrow bubble size (used in App) */
197-
.icon-wrapper{ width:32px; height:32px; }
198-
.github-blurb{ font-size:.95rem; }
177+
.tile--cta:hover {
178+
border-color: color-mix(in oklab, var(--nf-green) 60%, transparent);
179+
box-shadow: 0 12px 28px rgba(0,0,0,.32), 0 0 0 2px color-mix(in oklab, var(--nf-green) 35%, transparent);
180+
}
181+
.tile--github.tile--cta:hover {
182+
box-shadow: 0 14px 30px rgba(0,0,0,.35), 0 0 0 2px color-mix(in oklab, var(--nf-green) 35%, transparent);
183+
border-color: color-mix(in oklab, var(--nf-green) 60%, transparent);
184+
}
185+
186+
/* =========================
187+
Minimalist Theme Toggle — SVG-only
188+
========================= */
189+
.theme-toggle {
190+
display: inline-grid;
191+
place-items: center;
192+
width: 52px;
193+
height: 52px;
194+
border: none;
195+
background: transparent;
196+
color: inherit;
197+
cursor: pointer;
198+
transition: transform 0.15s ease, opacity 0.15s ease;
199+
}
200+
.theme-toggle:hover { opacity: 0.85; transform: scale(1.05); }
201+
.theme-toggle svg { width: 46px; height: 46px; display: block; }
202+
.theme-toggle span, .tile-title, .appearance-label { display: none !important; }
203+
:root[data-bs-theme="dark"] .theme-toggle { color: #cee994; }
204+
:root[data-bs-theme="light"] .theme-toggle { color: #a3d1fecc; }
205+
.tile .theme-toggle { margin: auto; display: flex; justify-content: center; align-items: center; }
206+
/* Optional circular version */
207+
/* .theme-toggle { border-radius: 50%; background: rgba(255,255,255,0.05); } */

0 commit comments

Comments
 (0)