|
2 | 2 | import React, { useEffect, useRef, useState } from "react"; |
3 | 3 | import gsap from "gsap"; |
4 | 4 | import { FaFile, FaCopy, FaPencilRuler } from "react-icons/fa"; |
5 | | -import { IoMdCloseCircle } from "react-icons/io"; |
| 5 | +import { IoMdCloseCircle, IoMdMoon } from "react-icons/io"; |
6 | 6 | import { HiSparkles } from "react-icons/hi2"; |
7 | 7 | import { RiTailwindCssFill } from "react-icons/ri"; |
| 8 | +import { MdSunny } from "react-icons/md"; |
8 | 9 |
|
9 | 10 | // Map icon names to actual components |
10 | 11 | const iconMap = { |
@@ -44,6 +45,7 @@ export default function Hero() { |
44 | 45 | const copyButtonRef = useRef(null); |
45 | 46 | const pointerRef = useRef(null); |
46 | 47 | const [copyText, setCopyText] = useState("Copy"); |
| 48 | + const [isCardDarkMode, setIsCardDarkMode] = useState(true); |
47 | 49 |
|
48 | 50 | useEffect(() => { |
49 | 51 | if (copyButtonRef.current && pointerRef.current) { |
@@ -81,11 +83,11 @@ export default function Hero() { |
81 | 83 | {features.map((item, idx) => ( |
82 | 84 | <div |
83 | 85 | key={idx} |
84 | | - className={`rounded-xl bg-white shadow-lg flex flex-col justify-between ${ |
| 86 | + className={`rounded-xl shadow-lg flex flex-col justify-between ${ |
85 | 87 | idx === 0 |
86 | 88 | ? "col-span-1 sm:col-span-2 md:col-span-2 md:row-span-2" |
87 | 89 | : "p-0" |
88 | | - }`} |
| 90 | + } ${idx === 3 && isCardDarkMode ? "bg-neutral-900 text-white" : "bg-white"}`} |
89 | 91 | > |
90 | 92 | {idx === 0 ? ( |
91 | 93 | <> |
@@ -122,7 +124,7 @@ export default function Hero() { |
122 | 124 | Card Title |
123 | 125 | </h4> |
124 | 126 | <p className="text-sm text-neutral-600 mb-2"> |
125 | | - This is a clean, minimal card to showcase StreamUI design. |
| 127 | + This is a clean, minimal card. |
126 | 128 | </p> |
127 | 129 | <button className="px-3 py-1 text-sm rounded-md border border-neutral-300 text-neutral-700 hover:bg-neutral-100 transition"> |
128 | 130 | Action |
@@ -159,8 +161,17 @@ export default function Hero() { |
159 | 161 | ) : ( |
160 | 162 | <> |
161 | 163 | <div className="flex justify-between mx-2 my-2"> |
162 | | - <IoMdCloseCircle className="text-lg text-black opacity-50" /> |
163 | | - <IoMdCloseCircle className="text-lg text-black opacity-50" /> |
| 164 | + {idx === 3 ? ( |
| 165 | + <> |
| 166 | + <IoMdCloseCircle className={`text-lg ${isCardDarkMode ? "text-white" : "text-black"} opacity-50`} /> |
| 167 | + <IoMdCloseCircle className={`text-lg ${isCardDarkMode ? "text-white" : "text-black"} opacity-50`} /> |
| 168 | + </> |
| 169 | + ) : ( |
| 170 | + <> |
| 171 | + <IoMdCloseCircle className="text-lg text-black opacity-50" /> |
| 172 | + <IoMdCloseCircle className="text-lg text-black opacity-50" /> |
| 173 | + </> |
| 174 | + )} |
164 | 175 | </div> |
165 | 176 | {idx === 1 ? ( |
166 | 177 | <> |
@@ -203,25 +214,66 @@ export default function Hero() { |
203 | 214 | </svg> |
204 | 215 | </div> |
205 | 216 | </div> |
| 217 | + ) : idx === 3 ? ( |
| 218 | + <> |
| 219 | + {/* Toggle Switch */} |
| 220 | + <label className="relative inline-flex items-center cursor-pointer mb-4"> |
| 221 | + <input |
| 222 | + type="checkbox" |
| 223 | + checked={isCardDarkMode} |
| 224 | + onChange={() => setIsCardDarkMode(!isCardDarkMode)} |
| 225 | + className="sr-only peer" |
| 226 | + /> |
| 227 | + <div className="w-14 h-8 bg-gray-200 rounded-full flex items-center px-1 peer-checked:bg-neutral-700 transition relative"> |
| 228 | + <span className="text-xs"><MdSunny/></span> |
| 229 | + <div className={`absolute top-1 left-1 w-6 h-6 bg-white rounded-full transition-transform flex items-center justify-center text-xs |
| 230 | + ${isCardDarkMode ? "translate-x-6" : ""}`}> |
| 231 | + {isCardDarkMode ? <IoMdMoon className="text-black"/> : <MdSunny/>} |
| 232 | + </div> |
| 233 | + <span className="text-xs ml-auto"><IoMdMoon/></span> |
| 234 | + </div> |
| 235 | + </label> |
| 236 | + <h3 className="font-medium text-lg"> |
| 237 | + {item.title} |
| 238 | + </h3> |
| 239 | + {item.description && ( |
| 240 | + <p className="text-sm max-w-xs mt-1 px-1 dark:text-white opacity-75"> |
| 241 | + {item.description} |
| 242 | + </p> |
| 243 | + )} |
| 244 | + </> |
206 | 245 | ) : ( |
207 | 246 | iconMap[item.icon] && |
208 | 247 | React.createElement(iconMap[item.icon], { |
209 | 248 | className: "text-4xl mb-4", |
210 | 249 | }) |
211 | 250 | )} |
212 | | - <h3 className="font-medium text-neutral-800 text-lg"> |
213 | | - {item.title} |
214 | | - </h3> |
215 | | - {item.description && ( |
216 | | - <p className="text-sm text-neutral-600 max-w-xs mt-1 px-1"> |
217 | | - {item.description} |
218 | | - </p> |
| 251 | + {idx !== 3 && ( |
| 252 | + <> |
| 253 | + <h3 className="font-medium text-neutral-800 text-lg"> |
| 254 | + {item.title} |
| 255 | + </h3> |
| 256 | + {item.description && ( |
| 257 | + <p className="text-sm text-neutral-600 max-w-xs mt-1 px-1"> |
| 258 | + {item.description} |
| 259 | + </p> |
| 260 | + )} |
| 261 | + </> |
219 | 262 | )} |
220 | 263 | </div> |
221 | 264 | )} |
222 | 265 | <div className="flex justify-between mx-2 my-2"> |
223 | | - <IoMdCloseCircle className="text-lg text-black opacity-50" /> |
224 | | - <IoMdCloseCircle className="text-lg text-black opacity-50" /> |
| 266 | + {idx === 3 ? ( |
| 267 | + <> |
| 268 | + <IoMdCloseCircle className={`text-lg ${isCardDarkMode ? "text-white" : "text-black"} opacity-50`} /> |
| 269 | + <IoMdCloseCircle className={`text-lg ${isCardDarkMode ? "text-white" : "text-black"} opacity-50`} /> |
| 270 | + </> |
| 271 | + ) : ( |
| 272 | + <> |
| 273 | + <IoMdCloseCircle className="text-lg text-black opacity-50" /> |
| 274 | + <IoMdCloseCircle className="text-lg text-black opacity-50" /> |
| 275 | + </> |
| 276 | + )} |
225 | 277 | </div> |
226 | 278 | </> |
227 | 279 | )} |
|
0 commit comments