quel syntaxe html si je souhaite rajouter dans le <div className='left-part-sub-string'>…
- User
quel syntaxe html si je souhaite rajouter dans le 3 boutons type checbkox (mode selectionné ou non selectionné) étant : 20 Juillet, 21 Juillet, 22 Juillet en sachant que ces boutton devront permettre une sauvegarde dans les cookies react : import { motion } from 'framer-motion'; import { useState } from 'react';
type Props = { id: number; title: string; price: number|string; nbTicket: number; };
export default function TicketCard(props: Props) { const [isOpen, setIsOpen] = useState(false); const [tickets, setTickets] = useState(props.nbTicket); const [rotation, setRotation] = useState(0); const handleTicketChange = (newTickets: number, event: React.MouseEvent) => { event.stopPropagation(); setTickets(newTickets); };
const contentVariants = { closed: { opacity: 0, height: 0, overflow: 'hidden', transition: { duration: 0.2, ease: 'easeInOut', when: 'afterChildren', }, }, open: { opacity: 1, height: typeof props.price === 'string' ? 140 : 80, transition: { duration: 0.2, ease: 'easeInOut', when: 'beforeChildren', } }, };
const cardVariants = { hidden: { opacity: 0, y: 50 }, visible: { opacity: 1, y: 0, transition: { type: 'spring', stiffness: 120, }, }, };
return ( <motion.div className="ticket-card" layout initial="hidden" animate="visible" variants={cardVariants} onClick={() => { setIsOpen(!isOpen); setRotation(rotation === 0 ? 90 : 0); }} > {props.title} Les tickets ne sont pas remboursables. Dernière entrée à 11H. {props.price}€ <motion.div className="svg-container" animate={{ rotate: rotation }}> </motion.div>
code<motion.divclassName={
sub-menu ${typeof props.price === 'string' ? 'large' : ''}} variants={contentVariants} initial="closed" animate={isOpen ? "open" : "closed"} exit="closed"{typeof props.price === 'string' ? ( x{tickets} Article(s) sélectionné(s)
// Définition des types pour les données que vous souhaitez stocker dans les cookies interface UserData { username: string; email: string; // ... autres champs }
// Fonction pour définir un cookie export const setCookie = (key: string, value: any, options?: Cookies.CookieAttributes) => { Cookies.set(key, JSON.stringify(value), options); };
// Fonction pour récupérer un cookie export const getCookie = (key: string): any | null => { const cookie = Cookies.get(key); return cookie ? JSON.parse(cookie) : null; };
// Fonction pour supprimer un cookie export const removeCookie = (key: string) => { Cookies.remove(key); };
type userData= { pseudoUser: string; emailUser: string; idUser: number; }
export const setUserCookie = (user: userData) => { setCookie("Connected", user, {expires: 7}); }
export const isConnected = ():boolean => { const user = getCookie("Connected"); if (user){ return true; } return false; }
- Assistant
- User
il s'agit d'un projet typescript
- Assistant
- User
- Assistant
- User
[{ "resource": "/C:/Users/alexa/Desktop/sae-fest-iuto-front/src/components/TicketCard.tsx", "owner": "typescript", "code": "2304", "severity": 8, "message": "Cannot find name 'setCookie'.", "source": "ts", "startLineNumber": 28, "startColumn": 3, "endLineNumber": 28, "endColumn": 12 }][{ "resource": "/C:/Users/alexa/Desktop/sae-fest-iuto-front/src/components/TicketCard.tsx", "owner": "typescript", "code": "2345", "severity": 8, "message": "Argument of type '{ [x: string]: boolean | DateSelection; dateSelection: DateSelection; }' is not assignable to parameter of type 'SetStateAction'.\n Type '{ [x: string]: boolean | DateSelection; dateSelection: DateSelection; }' is missing the following properties from type 'DateSelection': '20Juillet', '21Juillet', '22Juillet'", "source": "ts", "startLineNumber": 25, "startColumn": 20, "endLineNumber": 25, "endColumn": 36 }]
- Assistant