@@ -12,6 +12,7 @@ import translation from "@/translations/global.json";
12
12
import { useSettingsModalStore } from "@/store/SettingsModalStore" ;
13
13
import { useCubesModalStore } from "@/store/CubesModalStore" ;
14
14
import useClickOutside from "@/hooks/useClickOutside" ;
15
+ import { AnimatePresence , motion } from "framer-motion" ;
15
16
16
17
export default function Select ( ) {
17
18
const [ open , setOpen ] = useState < boolean > ( false ) ;
@@ -51,17 +52,36 @@ export default function Select() {
51
52
< SelectOptions />
52
53
</ div >
53
54
</ button >
54
- { open === true ? (
55
- < div
56
- id = "list-options"
57
- className = {
58
- "absolute z-40 overflow-auto max-h-[400px] p-1 top-12 mt-1 right-0 w-full h-auto border rounded-md light:bg-neutral-200 light:border-neutral-400 light:text-neutral-900 dark:bg-zinc-900 dark:border-zinc-700 dark:text-slate-100"
59
- }
60
- >
61
- { /* Favorites */ }
62
- < LabelSection description = { translation . inputs [ "favorites" ] [ lang ] } />
63
- { cubes ?. map ( ( cube ) => {
64
- if ( cube . favorite ) {
55
+ < AnimatePresence >
56
+ { open === true ? (
57
+ < motion . div
58
+ initial = { { y : 0 , scale : 0.9 , opacity : 0.8 } }
59
+ animate = { { y : 0 , scale : 1 , opacity : 1 } }
60
+ exit = { { x : 0 , scale : 0.9 , opacity : 0 } }
61
+ id = "list-options"
62
+ className = {
63
+ "absolute z-40 overflow-auto max-h-[400px] p-1 top-12 mt-1 right-0 w-full h-auto border rounded-md light:bg-neutral-200 light:border-neutral-400 light:text-neutral-900 dark:bg-zinc-900 dark:border-zinc-700 dark:text-slate-100"
64
+ }
65
+ >
66
+ { /* Favorites */ }
67
+ < LabelSection
68
+ description = { translation . inputs [ "favorites" ] [ lang ] }
69
+ />
70
+ { cubes ?. map ( ( cube ) => {
71
+ if ( cube . favorite ) {
72
+ return (
73
+ < Option
74
+ key = { genId ( ) }
75
+ name = { cube . name }
76
+ category = { cube . category }
77
+ cubeId = { cube . id }
78
+ handleClose = { handleClose }
79
+ />
80
+ ) ;
81
+ }
82
+ } ) }
83
+ < LabelSection description = { translation . inputs [ "list" ] [ lang ] } />
84
+ { cubes ?. map ( ( cube ) => {
65
85
return (
66
86
< Option
67
87
key = { genId ( ) }
@@ -71,23 +91,11 @@ export default function Select() {
71
91
handleClose = { handleClose }
72
92
/>
73
93
) ;
74
- }
75
- } ) }
76
- < LabelSection description = { translation . inputs [ "list" ] [ lang ] } />
77
- { cubes ?. map ( ( cube ) => {
78
- return (
79
- < Option
80
- key = { genId ( ) }
81
- name = { cube . name }
82
- category = { cube . category }
83
- cubeId = { cube . id }
84
- handleClose = { handleClose }
85
- />
86
- ) ;
87
- } ) }
88
- < AddCubeOption />
89
- </ div >
90
- ) : null }
94
+ } ) }
95
+ < AddCubeOption />
96
+ </ motion . div >
97
+ ) : null }
98
+ </ AnimatePresence >
91
99
</ div >
92
100
</ >
93
101
) ;
0 commit comments