33import { useEffect , useState } from "react" ;
44import Link from "next/link" ;
55
6- // Styles
7- import style from "./SigList.module.scss" ;
8-
96// Modules
107import maxMatch from "@/modules/maxMatch" ;
118
129const API_URL = process . env . NEXT_PUBLIC_API_URL ;
1310
1411const SIG = ( child : any ) => {
1512 return (
16- < Link className = { style . sig } href = { `/@${ child . customId } ` } >
13+ < Link
14+ className = "group relative w-20 h-20 flex-shrink-0 rounded-2xl bg-gradient-to-br from-[#6fa8ff] via-[#4a9dd4] to-[#30b4ac] p-2 flex flex-col items-center justify-center hover:scale-110 hover:shadow-lg transition-all duration-300 hover:rotate-3"
15+ href = { `/@${ child . customId } ` }
16+ >
17+ < div className = "absolute inset-0 bg-white/0 group-hover:bg-white/10 rounded-2xl transition-colors duration-300" />
1718 { maxMatch ( child . name ) . map ( ( name , index ) => (
18- < p key = { index } > { name } </ p >
19+ < p key = { index } className = "text-white text-xs leading-3 font-semibold relative z-10 text-center" >
20+ { name }
21+ </ p >
1922 ) ) }
2023 </ Link >
2124 ) ;
2225} ;
2326
24- const Information = ( { sigListToggle } : { sigListToggle : Function } ) => {
27+ const SigList = ( { sigListToggle } : { sigListToggle : Function } ) => {
2528 const [ sigs , setSigs ] = useState < any > ( [ ] ) ;
29+ const [ isLoading , setIsLoading ] = useState ( true ) ;
2630
2731 useEffect ( ( ) => {
2832 ( async ( ) => {
@@ -33,33 +37,79 @@ const Information = ({ sigListToggle }: { sigListToggle: Function }) => {
3337 } )
3438 ) . json ( ) ;
3539
36- return setSigs ( res . data ) ;
40+ setSigs ( res . data ) ;
41+ setIsLoading ( false ) ;
3742 } catch ( error ) {
3843 console . log ( error ) ;
44+ setIsLoading ( false ) ;
3945 }
4046 } ) ( ) ;
4147 } , [ ] ) ;
4248
4349 return (
44- < div className = { style . popup } >
45- < div className = { style . outer } onClick = { ( ) => sigListToggle ( false ) } > </ div >
46- < div className = { style . overflow } >
47- < div className = { style . sigs } >
48- { sigs . map ( ( item : any ) => {
49- if ( item . _id !== "652d60b842cdf6a660c2b778" ) {
50- return (
51- < SIG
52- _id = { item . _id }
53- name = { item . name }
54- customId = { item . customId }
55- key = { item . _id }
56- />
57- ) ;
58- }
59- } ) }
50+ < div className = "fixed top-0 left-0 h-screen w-screen bg-black/70 backdrop-blur-sm grid place-items-center z-[999999] animate-fadeIn" >
51+ { /* Outer overlay */ }
52+ < div
53+ className = "w-full h-full absolute top-0 left-0"
54+ onClick = { ( ) => sigListToggle ( false ) }
55+ />
56+
57+ { /* Content */ }
58+ < div className = "bg-white/95 backdrop-blur-xl w-[90vw] max-w-md rounded-3xl shadow-2xl relative animate-slideUp overflow-hidden" >
59+ { /* Header */ }
60+ < div className = "sticky top-0 bg-gradient-to-br from-[#6fa8ff] to-[#30b4ac] px-6 py-4 flex justify-between items-center z-10" >
61+ < h2 className = "text-white text-xl font-bold" > 探索 SIGs</ h2 >
62+ < button
63+ onClick = { ( ) => sigListToggle ( false ) }
64+ className = "w-8 h-8 rounded-full bg-white/20 hover:bg-white/30 flex items-center justify-center transition-colors"
65+ >
66+ < svg
67+ className = "w-5 h-5 text-white"
68+ fill = "none"
69+ strokeLinecap = "round"
70+ strokeLinejoin = "round"
71+ strokeWidth = "2"
72+ viewBox = "0 0 24 24"
73+ stroke = "currentColor"
74+ >
75+ < path d = "M6 18L18 6M6 6l12 12" > </ path >
76+ </ svg >
77+ </ button >
78+ </ div >
79+
80+ { /* SIG Grid */ }
81+ < div className = "max-h-[60vh] overflow-y-auto custom-scrollbar p-6" >
82+ { isLoading ? (
83+ < div className = "flex justify-center items-center h-40" >
84+ < div className = "animate-spin rounded-full h-12 w-12 border-4 border-[#6fa8ff] border-t-transparent" > </ div >
85+ </ div >
86+ ) : (
87+ < div className = "grid grid-cols-3 gap-4 place-items-center" >
88+ { sigs . map ( ( item : any ) => {
89+ if ( item . _id !== "652d60b842cdf6a660c2b778" ) {
90+ return (
91+ < SIG
92+ _id = { item . _id }
93+ name = { item . name }
94+ customId = { item . customId }
95+ key = { item . _id }
96+ />
97+ ) ;
98+ }
99+ } ) }
100+ </ div >
101+ ) }
102+ </ div >
103+
104+ { /* Footer */ }
105+ < div className = "sticky bottom-0 bg-gradient-to-t from-white/95 to-transparent px-6 py-3 text-center" >
106+ < p className = "text-gray-500 text-xs" >
107+ 選擇一個 SIG 來探索更多內容
108+ </ p >
60109 </ div >
61110 </ div >
62111 </ div >
63112 ) ;
64113} ;
65- export default Information ;
114+
115+ export default SigList ;
0 commit comments