|
1 | 1 | 'use client'; |
2 | 2 |
|
3 | 3 | import { useState, useEffect, useCallback, useMemo } from 'react'; |
| 4 | +import { motion, AnimatePresence, LayoutGroup } from 'framer-motion'; |
4 | 5 | import { createClient } from '@/lib/supabase/client'; |
5 | 6 | import styles from './PactsPage.module.css'; |
6 | 7 | import CreatePactModal from '@/components/CreatePactModal'; |
@@ -170,16 +171,28 @@ export default function PactsPageClient({ user }) { |
170 | 171 | )} |
171 | 172 | </div> |
172 | 173 | ) : ( |
173 | | - <div className={styles.pactsGrid}> |
174 | | - {filteredPacts.map((pact) => ( |
175 | | - <PactCard |
176 | | - key={pact.id} |
177 | | - pact={pact} |
178 | | - onUpdate={handlePactUpdate} |
179 | | - onDelete={handleDeletePact} |
180 | | - /> |
181 | | - ))} |
182 | | - </div> |
| 174 | + <LayoutGroup> |
| 175 | + <motion.div className={styles.pactsGrid}> |
| 176 | + <AnimatePresence mode="popLayout"> |
| 177 | + {filteredPacts.map((pact) => ( |
| 178 | + <motion.div |
| 179 | + key={pact.id} |
| 180 | + layout |
| 181 | + initial={{ opacity: 0, scale: 0.9 }} |
| 182 | + animate={{ opacity: 1, scale: 1 }} |
| 183 | + exit={{ opacity: 0, scale: 0.9, transition: { duration: 0.2 } }} |
| 184 | + transition={{ type: "spring", stiffness: 500, damping: 30 }} |
| 185 | + > |
| 186 | + <PactCard |
| 187 | + pact={pact} |
| 188 | + onUpdate={handlePactUpdate} |
| 189 | + onDelete={handleDeletePact} |
| 190 | + /> |
| 191 | + </motion.div> |
| 192 | + ))} |
| 193 | + </AnimatePresence> |
| 194 | + </motion.div> |
| 195 | + </LayoutGroup> |
183 | 196 | )} |
184 | 197 |
|
185 | 198 | {/* Create Pact Modal */} |
|
0 commit comments