-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from SocialGouv/feat/user-discounts
feat: user discounts
- Loading branch information
Showing
31 changed files
with
3,481 additions
and
424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { Flex, Text } from "@chakra-ui/react"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import { OfferIncluded } from "~/server/api/routers/offer"; | ||
import { dottedPattern } from "~/utils/chakra-theme"; | ||
import { OfferKindBadge } from "../OfferKindBadge"; | ||
|
||
type OfferCardProps = { | ||
offer: OfferIncluded; | ||
displayExpiryDate?: boolean; | ||
}; | ||
|
||
const OfferCard = ({ offer, displayExpiryDate = false }: OfferCardProps) => { | ||
return ( | ||
<Link | ||
href={`/dashboard/offer/${ | ||
offer.kind === "code" ? "online" : "in-store" | ||
}/${offer.id}`} | ||
> | ||
<Flex flexDir="column"> | ||
<Flex | ||
bgColor={offer.partner.color} | ||
py={5} | ||
borderTopRadius={12} | ||
position="relative" | ||
justifyContent="center" | ||
alignItems="center" | ||
sx={{ ...dottedPattern("#ffffff") }} | ||
> | ||
<Flex alignItems="center" borderRadius="full" p={1} bgColor="white"> | ||
<Image | ||
src={offer.partner.icon.url ?? ""} | ||
alt={offer.partner.icon.alt ?? ""} | ||
width={32} | ||
height={32} | ||
/> | ||
</Flex> | ||
</Flex> | ||
<Flex | ||
flexDir="column" | ||
p={3} | ||
bgColor="white" | ||
borderBottomRadius={8} | ||
gap={2} | ||
boxShadow="md" | ||
> | ||
<Text fontSize="sm" fontWeight="medium"> | ||
{offer.partner.name} | ||
</Text> | ||
<Text fontWeight="bold" fontSize="sm" noOfLines={2} h="42px"> | ||
{offer.title} | ||
</Text> | ||
<OfferKindBadge kind={offer.kind} variant="light" /> | ||
{displayExpiryDate && ( | ||
<Flex | ||
alignSelf="start" | ||
borderRadius="2xl" | ||
bgColor="bgWhite" | ||
py={2} | ||
px={3} | ||
> | ||
<Text fontSize="xs" fontWeight="medium"> | ||
Expire le : {new Date(offer.validityTo).toLocaleDateString()} | ||
</Text> | ||
</Flex> | ||
)} | ||
</Flex> | ||
</Flex> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default OfferCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.