-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into pallavi-18-create-profile-page
- Loading branch information
Showing
25 changed files
with
1,026 additions
and
8,910 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,77 @@ | ||
import { Box, VStack, Text, Avatar, HStack } from "@chakra-ui/react"; | ||
import { Group } from "../pages/MyGroupsPage"; | ||
import "../styles/CompactGroup.css"; | ||
import ConstrainedText from "./ConstrainedText"; | ||
|
||
interface Props { | ||
group: Group; | ||
width: string; | ||
height: string; | ||
corners?: Array<boolean>; | ||
} | ||
|
||
const CompactGroupV1 = ({ | ||
group, | ||
width, | ||
height, | ||
corners = [false, false, false, false], | ||
}: Props) => { | ||
return ( | ||
<Box | ||
width={width} | ||
height={height} | ||
borderRadius={`${corners[0] ? "0%" : "20%"} ${ | ||
corners[1] ? "0%" : "20%" | ||
} ${corners[2] ? "0%" : "20%"} ${corners[3] ? "0%" : "20%"}`} | ||
padding="15px 20px 15px" | ||
className="container" | ||
> | ||
<VStack justifyContent="space-between" height="100%"> | ||
<ConstrainedText | ||
text={group.groupName} | ||
charLimit={14} | ||
style={{ | ||
fontSize: "2rem", | ||
fontWeight: "600", | ||
textAlign: "center", | ||
}} | ||
postfix="..." | ||
/> | ||
<ConstrainedText | ||
text={group.description} | ||
charLimit={150} | ||
style={{ fontSize: "1rem", flexGrow: "20" }} | ||
postfix="...(see more)" | ||
/> | ||
<HStack justifyContent="space-between" spacing="15px"> | ||
<Avatar width="75px" height="75px" /> | ||
<VStack justifyContent="end" spacing="5px"> | ||
<Text textAlign="center" fontSize="0.8rem"> | ||
Created {new Date(group.created).toDateString()} | ||
</Text> | ||
{group.members.length > 1 ? ( | ||
<HStack spacing="20px"> | ||
<Avatar size="md" /> | ||
{group.members.length > 2 ? <Avatar size="md" /> : undefined} | ||
{group.members.length > 3 ? ( | ||
<Box | ||
width="30px" | ||
height="30px" | ||
borderRadius="15px" | ||
backgroundColor="darkgray" | ||
display="flex" | ||
justifyContent="center" | ||
alignItems="center" | ||
> | ||
+{group.members ? group.members.length - 3 : ""} | ||
</Box> | ||
) : undefined} | ||
</HStack> | ||
) : undefined} | ||
</VStack> | ||
</HStack> | ||
</VStack> | ||
</Box> | ||
); | ||
}; | ||
export { CompactGroupV1 }; |
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,31 @@ | ||
import { Text } from "@chakra-ui/react"; | ||
import { CSSProperties } from "react"; | ||
|
||
interface Props { | ||
text: string; | ||
charLimit: number; | ||
style?: CSSProperties; | ||
prefix?: string; | ||
postfix?: string; | ||
} | ||
|
||
//Displays as much of provided text as it can, up to limit. Can prefix + postfix text. | ||
const ConstrainedText = ({ | ||
text, | ||
charLimit, | ||
prefix = "", | ||
postfix = "", | ||
style = {}, | ||
}: Props) => { | ||
return ( | ||
<Text style={style}> | ||
{prefix} | ||
{text.length <= charLimit | ||
? text | ||
: text.substring(0, Math.max(charLimit - postfix.length, 0))} | ||
<Text as="i">{text.length <= charLimit ? "" : postfix}</Text> | ||
</Text> | ||
); | ||
}; | ||
|
||
export default ConstrainedText; |
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.