File tree Expand file tree Collapse file tree 10 files changed +249
-155
lines changed Expand file tree Collapse file tree 10 files changed +249
-155
lines changed Original file line number Diff line number Diff line change @@ -41,4 +41,5 @@ yarn-error.log*
4141next-env.d.ts
4242
4343tests /reports
44- playwright-report
44+ playwright-report
45+ .env * .local
Original file line number Diff line number Diff line change 1313 "@types/node-fetch" : " ^2.6.12" ,
1414 "@vercel/toolbar" : " ^0.1.34" ,
1515 "flags" : " ^4.0.0" ,
16- "next" : " 15.1.6 " ,
16+ "next" : " 15.3.2 " ,
1717 "node-fetch" : " ^3.3.2" ,
1818 "react" : " ^19.0.0" ,
1919 "react-dom" : " ^19.0.0"
Original file line number Diff line number Diff line change 1+ import { flag } from "flags/next" ;
2+
3+ export const animationFeatureFlag = flag < boolean > ( {
4+ key : "animation-feature" ,
5+ description : "Enable animations in the app." ,
6+ decide : ( ) => {
7+ const isEnabled = process . env . ANIMATION_FEATURE_ENABLED === "true" ;
8+ console . log ( "Animation Feature Flag Enabled:" , isEnabled ) ;
9+ return isEnabled ;
10+ } ,
11+ } ) ;
Original file line number Diff line number Diff line change 1+ import { animationFeatureFlag } from "./flags" ;
2+ import AnimatedBox from "../components/AnimatedBox" ;
3+
4+ export default async function AnimationPage ( ) {
5+ const isAnimationFeatureEnabled = await animationFeatureFlag ( ) ;
6+
7+ return (
8+ < div >
9+ < h1 > Animation Feature Page</ h1 >
10+ { isAnimationFeatureEnabled ? (
11+ < div >
12+ < h2 > Animation is Enabled</ h2 >
13+ < AnimatedBox />
14+ </ div >
15+ ) : (
16+ < p > 🚫 Animation Feature is OFF</ p >
17+ ) }
18+ </ div >
19+ ) ;
20+ }
Original file line number Diff line number Diff line change 1+ .box {
2+ width : 100px ;
3+ height : 100px ;
4+ background-color : blue;
5+ margin : 20px auto;
6+ transition : transform 0.5s ease-in-out;
7+ }
8+
9+ .animate {
10+ transform : rotate (360deg );
11+ }
12+
13+ .toggleButton {
14+ display : block;
15+ margin : 10px auto;
16+ padding : 10px 20px ;
17+ background-color : # 0070f3 ;
18+ color : white;
19+ border : none;
20+ border-radius : 5px ;
21+ cursor : pointer;
22+ }
23+
24+ .toggleButton : hover {
25+ background-color : # 005bb5 ;
26+ }
Original file line number Diff line number Diff line change 1+ "use client" ;
2+
3+ import { useState } from "react" ;
4+ import styles from "./AnimatedBox.module.css" ;
5+
6+ export default function AnimatedBox ( ) {
7+ const [ isAnimating , setIsAnimating ] = useState ( false ) ;
8+
9+ const toggleAnimation = ( ) => {
10+ setIsAnimating ( ( prev ) => ! prev ) ;
11+ } ;
12+
13+ return (
14+ < div >
15+ < button onClick = { toggleAnimation } className = { styles . toggleButton } >
16+ { isAnimating ? "Stop Animation" : "Start Animation" }
17+ </ button >
18+ < div
19+ className = { `${ styles . box } ${ isAnimating ? styles . animate : "" } ` }
20+ > </ div >
21+ </ div >
22+ ) ;
23+ }
Original file line number Diff line number Diff line change 11import Link from "next/link" ;
22
3- export default function Header ( {
3+ export default async function Header ( {
44 toggleDarkMode,
55 darkMode,
66} : {
@@ -13,22 +13,25 @@ export default function Header({
1313 padding : "10px" ,
1414 borderBottom : "1px solid #ccc" ,
1515 display : "flex" ,
16- justifyContent : "space-between" ,
17- alignItems : "center" ,
1816 } }
1917 >
2018 < nav >
2119 < Link href = "/" style = { { marginRight : "15px" } } >
2220 Home
2321 </ Link >
24- < a href = "/form" style = { { marginRight : "15px" } } >
22+ < Link href = "/form" style = { { marginRight : "15px" } } >
2523 Form
26- </ a >
27- < a href = "/about" > About</ a >
24+ </ Link >
25+ < Link href = "/animation" style = { { marginRight : "15px" } } >
26+ Animation
27+ </ Link >
28+ < Link href = "/about" style = { { marginRight : "15px" } } >
29+ About
30+ </ Link >
31+ < button onClick = { toggleDarkMode } >
32+ Toggle { darkMode ? "Light" : "Dark" } Mode
33+ </ button >
2834 </ nav >
29- < button onClick = { toggleDarkMode } >
30- Toggle { darkMode ? "Light" : "Dark" } Mode
31- </ button >
3235 </ header >
3336 ) ;
3437}
Original file line number Diff line number Diff line change 11"use client" ;
2-
32import WeatherWidget from "./weather-widget" ;
43import TaskList from "./task-list" ;
54import Header from "./header" ; // Import the Header component
Original file line number Diff line number Diff line change 11import { weatherWidgetFlag } from "../../flags" ;
22import WeatherWidget from "./weather-widget" ;
3+ // import { animationFeatureFlag } from "../../flags";
34
45export default async function Home ( ) {
56 const isWeatherWidgetEnabled = await weatherWidgetFlag ( ) ;
7+ // const isAnimationFeatureEnabled = await animationFeatureFlag();
68
79 return (
810 < div >
You can’t perform that action at this time.
0 commit comments