Skip to content

Commit 8047743

Browse files
fix: resolve showcase page crash caused by undefined isDark prop
1 parent a0ed8e3 commit 8047743

5 files changed

Lines changed: 77 additions & 27 deletions

File tree

src/components/ourProjects.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ import { motion } from "framer-motion";
66
import React from "react";
77
import { useSafeColorMode } from "../utils/useSafeColorMode";
88
// Mobile-specific overrides for very small screens (<768px and <320px)
9-
import "./ourProjects.mobile.css";
10-
// Import projects data and types
9+
import "./ourProjects.mobile.css";// Import projects data and types
1110
import projectsData from "../data/projects.json";
1211
import type { ProjectsData, ProjectItem } from "../data/types";
1312

1413
/**
1514
* Legacy interface for backward compatibility
1615
* @deprecated Use ProjectsData from types.ts instead
1716
*/
18-
export interface OurProjectsData {
17+
export interface Data {
1918
tag: string;
2019
title: string;
2120
description: string;
@@ -29,12 +28,12 @@ export interface OurProjectsData {
2928
* Legacy props interface for backward compatibility
3029
* @deprecated Component now imports data directly
3130
*/
32-
export interface OurProjectsProps {
33-
OurProjectsData?: OurProjectsData;
31+
export interface Props {
32+
Data?: Data;
3433
}
3534

3635
/**
37-
* OurProjects Component
36+
* Component
3837
*
3938
* Displays a showcase of RecodeHive projects with interactive previews.
4039
* Now uses data-driven approach with JSON configuration for better maintainability.
@@ -48,8 +47,8 @@ export interface OurProjectsProps {
4847
*
4948
* @param props - Optional props for backward compatibility
5049
*/
51-
const OurProjects: React.FC<OurProjectsProps> = ({
52-
OurProjectsData: legacyData,
50+
const ShowcasePage: React.FC<Props> = ({
51+
Data: legacyData,
5352
}) => {
5453
const { colorMode, isDark } = useSafeColorMode();
5554

@@ -211,7 +210,7 @@ const SelectComponent = ({
211210
</div>
212211

213212
<div
214-
className={`ourprojects-embed-container relative col-span-1 min-h-[50vh] overflow-hidden p-4 md:col-span-8 md:min-h-[70vh] md:p-8`}
213+
className={`-embed-container relative col-span-1 min-h-[50vh] overflow-hidden p-4 md:col-span-8 md:min-h-[70vh] md:p-8`}
215214
>
216215
{/* Animated Mesh Background */}
217216
<div className="absolute inset-0 bg-gradient-to-br from-purple-600/30 via-blue-600/30 via-cyan-500/30 to-emerald-500/30">
@@ -288,7 +287,7 @@ const SelectComponent = ({
288287
className="perspective-1000 relative z-10"
289288
>
290289
<div
291-
className={`md:hover:rotateY-5 group ourprojects-embed-card h-[45vh] transform overflow-hidden rounded-2xl border-2 shadow-2xl backdrop-blur-md transition-all duration-700 hover:scale-105 sm:h-[50vh] sm:rounded-3xl md:h-[65vh] ${
290+
className={`md:hover:rotateY-5 group -embed-card h-[45vh] transform overflow-hidden rounded-2xl border-2 shadow-2xl backdrop-blur-md transition-all duration-700 hover:scale-105 sm:h-[50vh] sm:rounded-3xl md:h-[65vh] ${
292291
isDark
293292
? "border-purple-500/50 bg-gray-900/95 shadow-purple-500/25"
294293
: "border-blue-400/50 bg-white/95 shadow-blue-500/25"
@@ -398,7 +397,7 @@ const SelectComponent = ({
398397
src={
399398
PROJECT_URLS[items[activeItem].title] || "about:blank"
400399
}
401-
className="ourprojects-iframe pointer-events-none h-[220%] w-full origin-top border-0 sm:h-[200%]"
400+
className="-iframe pointer-events-none h-[220%] w-full origin-top border-0 sm:h-[200%]"
402401
initial={{ opacity: 0, y: 0 }}
403402
animate={{
404403
opacity: 1,
@@ -448,7 +447,7 @@ const SelectComponent = ({
448447

449448
{/* Dynamic Indicator */}
450449
<motion.div
451-
className={`ourprojects-live-indicator absolute right-4 bottom-4 flex items-center rounded-full px-3 py-2 text-xs font-medium text-white backdrop-blur-sm ${
450+
className={`-live-indicator absolute right-4 bottom-4 flex items-center rounded-full px-3 py-2 text-xs font-medium text-white backdrop-blur-sm ${
452451
items[activeItem].title === "Awesome GitHub Profile" ||
453452
items[activeItem].title === "Machine Learning Repository"
454453
? "bg-green-600/90"
@@ -469,7 +468,7 @@ const SelectComponent = ({
469468
</motion.div>
470469

471470
{/* Holographic Overlay */}
472-
<div className="ourprojects-overlay pointer-events-none absolute inset-0 bg-gradient-to-t from-black/30 via-transparent to-transparent">
471+
<div className="-overlay pointer-events-none absolute inset-0 bg-gradient-to-t from-black/30 via-transparent to-transparent">
473472
<div className="absolute inset-0 bg-gradient-to-br from-purple-500/10 via-transparent to-cyan-500/10"></div>
474473
</div>
475474
</motion.div>
@@ -581,4 +580,4 @@ const SelectComponent = ({
581580
);
582581
};
583582

584-
export default OurProjects;
583+
export default ShowcasePage;

src/pages/showcase/_components/ShowcaseCard/styles.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105

106106
position: relative;
107107
overflow: hidden;
108+
isolation: isolate;
108109
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
109110
border: var(--card-border);
110111
border-radius: 8px;
@@ -268,7 +269,6 @@
268269
);
269270
opacity: 0.5;
270271
transition: opacity 0.3s ease;
271-
mix-blend-mode: multiply;
272272
}
273273

274274
.card:hover .showcaseCardImage::after {

src/pages/showcase/_components/ShowcaseTagSelect/styles.module.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,16 @@ input:checked + .checkboxLabel:hover {
3636
opacity: 0.75;
3737
box-shadow: 0 0 2px 1px var(--ifm-color-primary-dark);
3838
}
39+
input[type="checkbox"] + .checkboxLabel {
40+
color: var(--ifm-color-content);
41+
}
42+
43+
[data-theme="dark"] input[type="checkbox"] + .checkboxLabel {
44+
color: #ffffff;
45+
border-color: #555555;
46+
}
47+
48+
[data-theme="light"] input[type="checkbox"] + .checkboxLabel {
49+
color: #000000;
50+
border-color: var(--ifm-color-secondary-darkest);
51+
}

src/pages/showcase/index.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
type TagType,
2727
} from "@site/src/data/users";
2828
import FavoriteIcon from "@site/src/components/svgIcons/FavoriteIcon";
29-
import { useColorMode } from "@docusaurus/theme-common";
29+
3030

3131
const TITLE =
3232
"recode hive: Framing all the opensource projects built by our community members";
@@ -185,11 +185,11 @@ function useSiteCountPlural() {
185185
);
186186
}
187187

188-
function ShowcaseFilters() {
188+
function ShowcaseFilters({ isDark = false }: { isDark?: boolean }) {
189189
const filteredUsers = useFilteredUsers();
190190
const siteCountPlural = useSiteCountPlural();
191191
return (
192-
<section className="margin-top--l margin-bottom--lg container">
192+
<section className="margin-top--l margin-bottom--lg container">
193193
<div className={clsx("margin-bottom--sm", styles.filterCheckbox)}>
194194
<div>
195195
<motion.h2
@@ -456,16 +456,9 @@ export default function Showcase(): JSX.Element {
456456
}
457457

458458
function ShowcaseContent() {
459-
const { colorMode } = useColorMode();
460-
const isDark = colorMode === "dark";
461459

462460
return (
463-
<main
464-
className={clsx(
465-
"",
466-
isDark ? "bg-[#121212] text-white" : "bg-white text-black",
467-
)}
468-
>
461+
<main className={styles.showcaseContainer}>
469462
<Head>
470463
<script
471464
async

src/pages/showcase/styles.module.css

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
font-size: 0.8rem;
3131
margin-top: 0.5rem;
3232
margin-right: 0.5rem;
33+
color: var(--ifm-color-content);
3334
}
3435

3536
[data-theme="dark"] .checkboxListItem {
36-
color: var(--dark-text-primary);
37+
color: var(--ifm-color-content);
3738
}
3839

3940
.checkboxListItem:last-child {
@@ -49,6 +50,8 @@
4950
border-radius: 15px;
5051
padding: 10px;
5152
border: 1px solid gray;
53+
color: var(--ifm-color-content);
54+
background: var(--ifm-background-color);
5255
}
5356

5457
[data-theme="dark"] .searchContainer input {
@@ -111,3 +114,45 @@
111114
background-clip: text;
112115
-webkit-text-fill-color: transparent;
113116
}
117+
[data-theme="dark"] .filterCheckbox {
118+
background-color: transparent !important;
119+
color: #ffffff !important;
120+
}
121+
122+
[data-theme="dark"] .checkboxList {
123+
background-color: transparent !important;
124+
}
125+
126+
[data-theme="dark"] .checkboxListItem {
127+
color: #ffffff !important;
128+
border-color: #444444 !important;
129+
}
130+
131+
[data-theme="light"] .checkboxListItem {
132+
color: #000000 !important;
133+
}
134+
135+
[data-theme="dark"] .showcaseFavorite {
136+
background-color: #1a1a1a !important;
137+
}
138+
[data-theme="dark"] .filterCheckbox {
139+
background-color: transparent !important;
140+
color: #ffffff !important;
141+
}
142+
143+
[data-theme="dark"] .checkboxList {
144+
background-color: transparent !important;
145+
}
146+
147+
[data-theme="dark"] .checkboxListItem {
148+
color: #ffffff !important;
149+
border-color: #444444 !important;
150+
}
151+
152+
[data-theme="light"] .checkboxListItem {
153+
color: #000000 !important;
154+
}
155+
156+
[data-theme="dark"] .showcaseFavorite {
157+
background-color: #1a1a1a !important;
158+
}

0 commit comments

Comments
 (0)