From eb38bdd06964499c6d9dbc2baf60f300eb1fa573 Mon Sep 17 00:00:00 2001 From: MichaelAngeloTheFirst Date: Sat, 17 Dec 2022 15:33:57 +0100 Subject: [PATCH 1/2] Button added --- src/components/SendPresents/SendPresents.tsx | 219 +++++++++++------- src/components/TablePackages/PackButton.tsx | 25 ++ src/components/TablePackages/PackModal.tsx | 20 ++ .../TablePackages/PackageTableRow.tsx | 31 +-- src/components/TablePackages/types.ts | 21 +- 5 files changed, 203 insertions(+), 113 deletions(-) create mode 100644 src/components/TablePackages/PackButton.tsx create mode 100644 src/components/TablePackages/PackModal.tsx diff --git a/src/components/SendPresents/SendPresents.tsx b/src/components/SendPresents/SendPresents.tsx index 4477646..86f74a6 100644 --- a/src/components/SendPresents/SendPresents.tsx +++ b/src/components/SendPresents/SendPresents.tsx @@ -1,99 +1,140 @@ import React from "react"; -import { Box, Button, Card, CardContent, Grid, makeStyles, Modal, Paper, styled, Typography } from "@mui/material"; -import StarIcon from '@mui/icons-material/Star'; -import CloseIcon from '@mui/icons-material/Close'; +import { + Box, + Button, + Card, + CardContent, + Grid, + makeStyles, + Modal, + Paper, + styled, + Typography, +} from "@mui/material"; +import StarIcon from "@mui/icons-material/Star"; +import CloseIcon from "@mui/icons-material/Close"; import ListModal from "../ListModal"; +import PackButton from "../TablePackages/PackButton"; +const SendPresents = () => { + const [open, setOpen] = React.useState(false); + const handleOpen = () => setOpen(true); + const handleClose = () => setOpen(false); -const SendPresents = () =>{ + const style = { + position: "absolute", + top: "50%", + left: "50%", + transform: "translate(-50%, -50%)", + width: 650, + bgcolor: "background.paper", + borderRadius: "12px", + boxShadow: 24, + p: 4, + display: "flex", + padding: "0", + flexDirection: "column", + }; - const [open, setOpen] = React.useState(false); - const handleOpen = () => setOpen(true); - const handleClose = () => setOpen(false); - - const style = { - position: 'absolute', - top: '50%', - left: '50%', - transform: 'translate(-50%, -50%)', - width: 650, - bgcolor: 'background.paper', - borderRadius: '12px', - boxShadow: 24, - p: 4, - display: 'flex', - padding: '0', - flexDirection: 'column', - }; - - - return (<> - - - - - - - - - Imię:
- x
- Nazwisko:
- xxx xxxxxxxx
- Wiek:
- x lat
- Grzeczność:
- x
- Kraj:
- x
- Miasto:
- x
- Ulica:
- x
-
-
+ return ( + <> + Open modal + + + + + + + + Imię: +
+ x
+ Nazwisko: +
+ xxx xxxxxxxx +
+ Wiek: +
+ x lat +
+ Grzeczność: +
+ x
+ Kraj: +
+ x
+ Miasto: +
+ x
+ Ulica: +
+ x
+
+
+
+ + + + + + + ID x
+ calendar xx.xx.xxxx +
+
- - - - - - - ID x
- calendar xx.xx.xxxx
-
-
- - - category - - - - - - -
-
- - - - - + + + category + + -
+ + -
-
-
- ) -} +
+
+ + + + + + + + + +
+ + ); +}; -export default SendPresents \ No newline at end of file +export default SendPresents; diff --git a/src/components/TablePackages/PackButton.tsx b/src/components/TablePackages/PackButton.tsx new file mode 100644 index 0000000..b627332 --- /dev/null +++ b/src/components/TablePackages/PackButton.tsx @@ -0,0 +1,25 @@ +import { Button } from "@mui/material"; +import { PackButtonProps } from "./types"; + +const PackButton = ({ onClick }: PackButtonProps) => { + return ( + + ); +}; + +export default PackButton; diff --git a/src/components/TablePackages/PackModal.tsx b/src/components/TablePackages/PackModal.tsx new file mode 100644 index 0000000..6bfacdd --- /dev/null +++ b/src/components/TablePackages/PackModal.tsx @@ -0,0 +1,20 @@ +import { Modal, Typography } from "@mui/material"; +import { useState } from "react"; +import PackButton from "./PackButton"; + +const PackModal = ({ id }: { id: number }) => { + const [open, setOpen] = useState(false); + const handleOpen = () => setOpen(true); + const handleClose = () => setOpen(false); + + return ( + <> + + + {id} + + + ); +}; + +export default PackModal; diff --git a/src/components/TablePackages/PackageTableRow.tsx b/src/components/TablePackages/PackageTableRow.tsx index cfd5b8e..9a346ca 100644 --- a/src/components/TablePackages/PackageTableRow.tsx +++ b/src/components/TablePackages/PackageTableRow.tsx @@ -3,37 +3,38 @@ import { TableCell, TableRow } from "@mui/material"; import PackagingStatus from "../PackagingStatus"; import { Packages } from "./types"; import CreationDate from "../CreationDate"; -import Name from "../../components/Name/Name" -import Country from '../../components/Name/Country'; +import Name from "../../components/Name/Name"; +import Country from "../../components/Name/Country"; import { SendPresents } from "../SendPresents"; -const PackageTableRow = ({ id, kindness, createdAt, status, ...rest }: Packages) => { +const PackageTableRow = ({ + id, + kindness, + createdAt, + status, + ...rest +}: Packages) => { return ( + {id} - {id} + - + - + + {rest.city} + - + - - {rest.city} - - - - - - ); }; diff --git a/src/components/TablePackages/types.ts b/src/components/TablePackages/types.ts index da63e8a..4636a57 100644 --- a/src/components/TablePackages/types.ts +++ b/src/components/TablePackages/types.ts @@ -13,14 +13,17 @@ export interface Packages { createdAt: string; } +export interface DeliveryStatus { + id: number; + wish_list_id: number; + name: string; + kindness: number; + status: string; + country: string; + city: string; + created_at: string; +} -export interface DeliveryStatus{ - id: number - wish_list_id: number - name: string - kindness: number - status: string - country: string - city: string - created_at: string +export interface PackButtonProps { + onClick: () => void; } From 6ab7e0ed552495e1ac34c1dde6f3c3be210b55ae Mon Sep 17 00:00:00 2001 From: MichaelAngeloTheFirst Date: Sat, 17 Dec 2022 16:38:37 +0100 Subject: [PATCH 2/2] xDDDDD --- .../PackagingStatus/PackagingStatus.tsx | 22 ++++++++++++++----- src/components/SendPresents/SendPresents.tsx | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/PackagingStatus/PackagingStatus.tsx b/src/components/PackagingStatus/PackagingStatus.tsx index 1b21283..23785fa 100644 --- a/src/components/PackagingStatus/PackagingStatus.tsx +++ b/src/components/PackagingStatus/PackagingStatus.tsx @@ -1,12 +1,22 @@ import Box from "@mui/system/Box"; import { useEffect, useState } from "react"; -import {DeliveryStatus} from './types'; +import { DeliveryStatus } from "./types"; -const PackagingStatus = ({status}: {status:string}) => { +const PackagingStatus = ({ status }: { status: string }) => { return ( - {status} + + {status} - ) -} + ); +}; -export default PackagingStatus; \ No newline at end of file +export default PackagingStatus; diff --git a/src/components/SendPresents/SendPresents.tsx b/src/components/SendPresents/SendPresents.tsx index 86f74a6..a3c0672 100644 --- a/src/components/SendPresents/SendPresents.tsx +++ b/src/components/SendPresents/SendPresents.tsx @@ -38,7 +38,7 @@ const SendPresents = () => { return ( <> - Open modal +