From 89d603105df1a8a3eec624188a9d4678e00ddf0a Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Tue, 9 Jan 2024 15:03:49 +1300 Subject: [PATCH] New search filter and cards Add the link buttons back to the ig card whoops I changed the buttons because I have to Help help #2 --- components/IGCard.tsx | 72 +++++++++++++++++------------------ components/IGSearchFilter.tsx | 49 +++++++++++++++++------- 2 files changed, 70 insertions(+), 51 deletions(-) diff --git a/components/IGCard.tsx b/components/IGCard.tsx index 7394295..37bf3fc 100644 --- a/components/IGCard.tsx +++ b/components/IGCard.tsx @@ -21,7 +21,7 @@ import { VStack, } from '@chakra-ui/react' import React from 'react' -import { FaTelegram, FaUserCircle } from 'react-icons/fa' +import { FaTelegram, FaUser, FaUserCircle } from 'react-icons/fa' import Link from 'next/link' import ImageWithFallback from './ImageWithFallback' import { DEFAULT_PNG_NAME } from '../utils' @@ -35,45 +35,28 @@ type LeftPaneProps = { imageKey: number imageSrc: string isInactive: boolean + inviteLink: string + primaryIGHead: User | null } const getContactButton = (contact: User | null, width?: string) => { - // const toast = useToast() - // - // const copyToClipboard = () => { - // const nameToCopy = contact?.name || 'No contact found' - // navigator.clipboard.writeText(nameToCopy) - // - // // Show toast alert - // toast({ - // title: 'Copied to clipboard!', - // status: 'success', - // duration: 3000, - // isClosable: true, - // position: 'bottom', - // }) - // } - // - // const isContactFound = contact !== null && contact.name !== undefined - return ( ) } -const LeftPane: React.FC = ({ imageKey, imageSrc, isInactive }) => { +const LeftPane: React.FC = ({ + imageKey, + imageSrc, + isInactive, + inviteLink, + primaryIGHead, +}) => { return ( - -
+ +
= ({ imageKey, imageSrc, isInactive }) = <> )}
+
{getContactButton(primaryIGHead, '95px')}
+
+ {getInviteLinkButton(inviteLink, '95px')} +
) } @@ -160,10 +156,10 @@ const IGCard: React.FC = ({ imageKey, ig_info }) => { = ({ imageKey, ig_info }) => { style={{ height: '100%' }} border='1px solid darkgrey' > - + @@ -182,7 +184,7 @@ const IGCard: React.FC = ({ imageKey, ig_info }) => { pt='1vh' css={{ display: '-webkit-box', - WebkitLineClamp: 3, + WebkitLineClamp: 4, WebkitBoxOrient: 'vertical', overflow: 'hidden', }} @@ -190,12 +192,6 @@ const IGCard: React.FC = ({ imageKey, ig_info }) => { {ig_info.description} - - - {getInviteLinkButton(inviteLink)} - {getContactButton(primaryIGHead)} - - diff --git a/components/IGSearchFilter.tsx b/components/IGSearchFilter.tsx index 940f66f..b5691c2 100644 --- a/components/IGSearchFilter.tsx +++ b/components/IGSearchFilter.tsx @@ -1,6 +1,7 @@ import React from 'react' import { Box, + Card, Center, Checkbox, CheckboxGroup, @@ -9,8 +10,10 @@ import { Input, InputGroup, InputLeftElement, + SimpleGrid, Stack, VStack, + useBreakpointValue, } from '@chakra-ui/react' import { SearchIcon } from '@chakra-ui/icons' import { DEFAULT_FILTERS } from '../pages/student-groups' @@ -28,9 +31,39 @@ const IGSearchFilter: React.FC = ({ onInactiveChange, interestGroupCategories, }) => { + const isGrid = useBreakpointValue({ base: true, md: false }) + + const CheckboxLayout = () => { + const checkboxes = Object.entries(interestGroupCategories).map((category) => ( + + {category[1]} + + )) + if (isGrid) { + return ( + + {checkboxes} + + Inactive + + + ) + } else { + return ( + + {checkboxes} + + + Inactive + + + ) + } + } + return ( - - + + @@ -44,17 +77,7 @@ const IGSearchFilter: React.FC = ({ /> - - {Object.entries(interestGroupCategories).map((category) => ( - - {category[1]} - - ))} - - - Inactive - - + )