mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-07-09 15:08:06 +00:00
feat(finished Card): Finished Card, missing responsive
This commit is contained in:
@@ -4,7 +4,7 @@ import Carousel from "./Carousel";
|
|||||||
export default function CardUser(props) {
|
export default function CardUser(props) {
|
||||||
const { user } = props;
|
const { user } = props;
|
||||||
// const data_user = props;
|
// const data_user = props;
|
||||||
const borderRad = "1.5rem";
|
const borderRad = "2rem";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
@@ -16,8 +16,8 @@ export default function CardUser(props) {
|
|||||||
<Carousel
|
<Carousel
|
||||||
user={user}
|
user={user}
|
||||||
borderRadiusImg={borderRad}
|
borderRadiusImg={borderRad}
|
||||||
heightPhoto={"60vh"}
|
heightPhoto={"75vh"}
|
||||||
heightText={"40vh"}
|
heightText={"25vh"}
|
||||||
/>
|
/>
|
||||||
<Flex>
|
<Flex>
|
||||||
<Box></Box>
|
<Box></Box>
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Box, IconButton, useBreakpointValue } from "@chakra-ui/react";
|
import {
|
||||||
|
Box,
|
||||||
|
Flex,
|
||||||
|
Spacer,
|
||||||
|
IconButton,
|
||||||
|
useBreakpointValue,
|
||||||
|
ButtonGroup,
|
||||||
|
Badge,
|
||||||
|
Text,
|
||||||
|
} from "@chakra-ui/react";
|
||||||
// Here we have used react-icons package for the icons
|
// Here we have used react-icons package for the icons
|
||||||
import { BiLeftArrowAlt, BiRightArrowAlt } from "react-icons/bi";
|
import {
|
||||||
|
BiLeftArrowAlt,
|
||||||
|
BiRightArrowAlt,
|
||||||
|
BiHeart,
|
||||||
|
// RxCross1,
|
||||||
|
} from "react-icons/bi";
|
||||||
|
|
||||||
|
import { RxCross1 } from "react-icons/rx";
|
||||||
// And react-slick as our Carousel Lib
|
// And react-slick as our Carousel Lib
|
||||||
import Slider from "react-slick";
|
import Slider from "react-slick";
|
||||||
|
|
||||||
@@ -19,11 +35,25 @@ const settings = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function Carousel(props) {
|
export default function Carousel(props) {
|
||||||
const { heightPhoto, heightText, borderRadiusImg, user } = props;
|
const { borderRadiusImg, user } = props;
|
||||||
// As we have used custom buttons, we need a reference variable to
|
// As we have used custom buttons, we need a reference variable to
|
||||||
// change the state
|
// change the state
|
||||||
|
|
||||||
|
// C'est l'utilisateur qui est login
|
||||||
|
const actualUser = {
|
||||||
|
lastName: "Alexandra",
|
||||||
|
firstName: "Lamie",
|
||||||
|
age: 21,
|
||||||
|
aPropos: "Je suis la personne fictive la plus fictive",
|
||||||
|
images: ["401446.webp"],
|
||||||
|
passions: ["Sport", "Voiture", "Cuisine"],
|
||||||
|
};
|
||||||
|
|
||||||
const [slider, setSlider] = React.useState();
|
const [slider, setSlider] = React.useState();
|
||||||
|
|
||||||
|
const heightPhoto = "75vh";
|
||||||
|
const heightText = "25vh";
|
||||||
|
|
||||||
// These are the breakpoints which changes the position of the
|
// These are the breakpoints which changes the position of the
|
||||||
// buttons as the screen size changes
|
// buttons as the screen size changes
|
||||||
const top = useBreakpointValue({ base: "90%", md: "50%" });
|
const top = useBreakpointValue({ base: "90%", md: "50%" });
|
||||||
@@ -98,10 +128,53 @@ export default function Carousel(props) {
|
|||||||
))}
|
))}
|
||||||
</Slider>
|
</Slider>
|
||||||
</Box>
|
</Box>
|
||||||
<Box height={heightText} bgGradient="radial(purple.200, purple.300)">
|
<Box
|
||||||
<h1>
|
height={heightText}
|
||||||
{user.name} {user.surname} , {user.age}
|
borderBottomRadius={borderRadiusImg}
|
||||||
</h1>
|
// bgGradient="radial(purple.200, purple.300)"
|
||||||
|
>
|
||||||
|
<Flex m={"1vh"}>
|
||||||
|
<h1
|
||||||
|
style={{
|
||||||
|
fontSize: "1.5rem",
|
||||||
|
fontWeight: "bold",
|
||||||
|
textAlign: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{user.firstName} {user.lastName} , {user.age} ans
|
||||||
|
</h1>
|
||||||
|
<Spacer />
|
||||||
|
<Box alignItems="center" display="flex">
|
||||||
|
<Flex flexDirection={{ base: "row", sm: "column" }}>
|
||||||
|
<ButtonGroup gap={"0.5rem"}>
|
||||||
|
<IconButton borderRadius={"1rem"} colorScheme={"pink"}>
|
||||||
|
<BiHeart />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton borderRadius={"1rem"} colorScheme={"red"}>
|
||||||
|
<RxCross1 />
|
||||||
|
</IconButton>
|
||||||
|
</ButtonGroup>
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<Box m={"1vh"}>
|
||||||
|
<Text style={{ fontWeight: "bold" }}>{user.aPropos}</Text>
|
||||||
|
</Box>
|
||||||
|
<Box m={"1vh"}>
|
||||||
|
<h2 style={{ fontWeight: "bold" }}>Passions :</h2>
|
||||||
|
<Flex gap={"0.5rem"} mt={"1vh"}>
|
||||||
|
{user.passions.map((passion, index) =>
|
||||||
|
actualUser.passions.includes(passion) ? (
|
||||||
|
<Badge borderRadius={"0.5rem"} colorScheme={"purple"}>
|
||||||
|
#{passion}
|
||||||
|
</Badge>
|
||||||
|
) : (
|
||||||
|
<Badge borderRadius={"0.5rem"}>#{passion}</Badge>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
import {NextApiRequest, NextApiResponse} from 'next';
|
import { NextApiRequest, NextApiResponse } from "next";
|
||||||
import { PrismaClient } from '@prisma/client'
|
import { PrismaClient } from "@prisma/client";
|
||||||
|
|
||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
export default async function readUser(req: NextApiRequest, res: NextApiResponse) {
|
export default async function readUser(
|
||||||
|
req: NextApiRequest,
|
||||||
const {email, password} = req.query
|
res: NextApiResponse
|
||||||
|
) {
|
||||||
if(!email) {
|
const { email, password } = req.query;
|
||||||
const users = await prisma.user.findMany()
|
|
||||||
return res.status(200).send({message: "readUser", users});
|
if (!email && !password) {
|
||||||
|
const users = await prisma.user.findMany();
|
||||||
|
return res.status(200).send({ message: "readUser", users });
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await prisma.user.findUnique({where :{"email" : email}})
|
const user = await prisma.user.findUnique({ where: { email: email } });
|
||||||
|
|
||||||
if (user?.password == password) {
|
if (user?.password == password) {
|
||||||
res.status(200).send({message: "User found", user});
|
res.status(200).send({ message: "User found", user });
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status(400).send({message: "Mot de passe incorrect"});
|
res.status(400).send({ message: "Mot de passe incorrect" });
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ import CardUser from "../components/CardUser";
|
|||||||
|
|
||||||
export default function Test_card() {
|
export default function Test_card() {
|
||||||
const user = {
|
const user = {
|
||||||
name: "dujardin",
|
lastName: "dujardin",
|
||||||
surname: "jean",
|
firstName: "jean",
|
||||||
age: 19,
|
age: 19,
|
||||||
aPropos: "Je suis une personne fictive, pas tres fictive",
|
aPropos: "Je suis une personne fictive, pas tres fictive",
|
||||||
images: ["401446.webp"],
|
images: ["401446.webp"],
|
||||||
passions: ["Sport", "Piscine", "Formule1"],
|
passions: ["Sport", "Piscine", "Formule1"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//faudra faire une requete sur la BD pour chaque utilisateurs
|
||||||
|
|
||||||
return <CardUser user={user} />;
|
return <CardUser user={user} />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user