Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | "use client" import type React from "react" import { useState, useEffect } from "react" import { motion } from "framer-motion" import { format } from "date-fns" import { Wifi, Volume2, BatteryCharging, ChevronRight } from "lucide-react" import styles from "./LoginScreen.module.css" interface LoginScreenProps { onUnlock: () => void } export default function LoginScreen({ onUnlock }: LoginScreenProps) { const [currentTime, setCurrentTime] = useState(new Date()) const [isTyping, setIsTyping] = useState(false) const [password, setPassword] = useState("") useEffect(() => { const timer = setInterval(() => { setCurrentTime(new Date()) }, 1000) return () => clearInterval(timer) }, []) const handlePasswordChange = (e: React.ChangeEvent<HTMLInputElement>) => { setPassword(e.target.value) } const handleLogin = (e: React.FormEvent) => { e.preventDefault() // For a viewer experience, any input "unlocks" it. // In a real app, you'd check credentials here. onUnlock() } const handleInputFocus = () => { setIsTyping(true) } const handleInputBlur = () => { if (password === "") { setIsTyping(false) } } const backgroundVariants = { initial: { opacity: 0 }, animate: { opacity: 1, transition: { duration: 1, ease: "easeOut", }, }, } const cardVariants = { hidden: { y: 50, opacity: 0, scale: 0.9 }, visible: { y: 0, opacity: 1, scale: 1, transition: { delay: 0.5, duration: 0.6, ease: "easeOut", }, }, } const particleVariants = { animate: { y: [0, -1000], opacity: [0, 1, 0], scale: [0.5, 1.5, 0.5], transition: { duration: 10 + Math.random() * 10, repeat: Number.POSITIVE_INFINITY, ease: "linear", delay: Math.random() * 5, }, }, } return ( <motion.div className={styles.loginScreen} initial="initial" animate="animate" variants={backgroundVariants}> <div className={styles.gradientBackground} /> <div className={styles.particlesContainer}> {[...Array(50)].map((_, i) => ( <motion.div key={i} className={styles.particle} variants={particleVariants} animate="animate" style={{ left: `${Math.random() * 100}%`, top: `${100 + Math.random() * 20}%`, // Start below screen }} /> ))} </div> <div className={styles.statusBar}> <div className={styles.statusLeft}> <span>{format(currentTime, "HH:mm")}</span> </div> <div className={styles.statusRight}> <Wifi size={16} /> <Volume2 size={16} /> <BatteryCharging size={16} /> </div> </div> <div className={styles.timeDate}> <motion.h1 initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.2, duration: 0.5 }} > {format(currentTime, "h:mm")} </motion.h1> <motion.p initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.3, duration: 0.5 }} > {format(currentTime, "EEEE, MMMM d")} </motion.p> </div> <motion.div className={styles.loginCard} initial="hidden" animate="visible" variants={cardVariants}> <motion.div className={styles.avatar} animate={{ rotateY: 360 }} transition={{ duration: 10, repeat: Number.POSITIVE_INFINITY, ease: "linear" }} > <img src="/placeholder.svg?height=100&width=100" alt="User Avatar" /> </motion.div> <h2>Mohamed Gamal</h2> <form onSubmit={handleLogin} className={styles.passwordForm}> <div className={styles.inputGroup}> <input type="password" placeholder={isTyping ? "" : "Enter to unlock"} value={password} onChange={handlePasswordChange} onFocus={handleInputFocus} onBlur={handleInputBlur} className={styles.passwordInput} aria-label="Password" /> <button type="submit" className={styles.submitButton} aria-label="Unlock"> <ChevronRight size={20} /> </button> </div> </form> <p className={styles.hintText}>Click or press Enter to unlock</p> </motion.div> </motion.div> ) } |