-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update card list items for new creator data
- Loading branch information
Showing
10 changed files
with
417 additions
and
113 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
52 changes: 52 additions & 0 deletions
52
packages/components/src/CardListItem/CardDetailsFallback.tsx
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,52 @@ | ||
import { Flex } from 'theme-ui' | ||
|
||
import { Category } from '../Category/Category' | ||
import { MemberBadge } from '../MemberBadge/MemberBadge' | ||
import { Username } from '../Username/Username' | ||
|
||
import type { ListItem } from './types' | ||
|
||
interface IProps { | ||
item: ListItem | ||
} | ||
|
||
export const CardDetailsFallback = ({ item }: IProps) => { | ||
const { _id, isSupporter, isVerified, subType, type } = item | ||
|
||
return ( | ||
<Flex sx={{ padding: 2, gap: 2 }}> | ||
<MemberBadge profileType={type} size={50} /> | ||
<Flex sx={{ flexDirection: 'column', gap: 2 }}> | ||
<Username | ||
user={{ | ||
userName: _id, | ||
isVerified: isVerified || false, | ||
isSupporter: isSupporter || false, | ||
}} | ||
sx={{ alignSelf: 'flex-start' }} | ||
isLink={false} | ||
/> | ||
{subType && ( | ||
<Category | ||
category={{ label: 'Wants to get started' }} | ||
sx={{ | ||
border: '1px solid #0087B6', | ||
backgroundColor: '#ECFAFF', | ||
color: '#0087B6', | ||
}} | ||
/> | ||
)} | ||
{type === 'member' && ( | ||
<Category | ||
category={{ label: 'Wants to get started' }} | ||
sx={{ | ||
border: '1px solid #A72E5A', | ||
backgroundColor: '#F7C7D9', | ||
color: '#A72E5A', | ||
}} | ||
/> | ||
)} | ||
</Flex> | ||
</Flex> | ||
) | ||
} |
70 changes: 70 additions & 0 deletions
70
packages/components/src/CardListItem/CardDetailsMemberProfile.tsx
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,70 @@ | ||
import { Avatar, Box, Flex } from 'theme-ui' | ||
|
||
import { Category } from '../Category/Category' | ||
import { MemberBadge } from '../MemberBadge/MemberBadge' | ||
import { Username } from '../Username/Username' | ||
|
||
import type { IProfileCreator } from './types' | ||
|
||
interface IProps { | ||
creator: IProfileCreator | ||
} | ||
|
||
export const CardDetailsMemberProfile = ({ creator }: IProps) => { | ||
const { _id, badges, countryCode, profileType, userImage } = creator | ||
return ( | ||
<Flex | ||
sx={{ | ||
gap: 2, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
padding: 2, | ||
alignContent: 'stretch', | ||
}} | ||
> | ||
{userImage && ( | ||
<Box sx={{ aspectRatio: 1, width: '60px', height: '60px' }}> | ||
<Flex | ||
sx={{ | ||
alignContent: 'flex-start', | ||
justifyContent: 'flex-end', | ||
flexWrap: 'wrap', | ||
}} | ||
> | ||
<Avatar | ||
src={userImage} | ||
sx={{ width: '60px', height: '60px', objectFit: 'cover' }} | ||
/> | ||
<MemberBadge | ||
profileType={profileType} | ||
size={22} | ||
sx={{ transform: 'translateY(-22px)' }} | ||
/> | ||
</Flex> | ||
</Box> | ||
)} | ||
{!userImage && <MemberBadge profileType={profileType} size={50} />} | ||
|
||
<Flex sx={{ flexDirection: 'column', gap: 1, flex: 1 }}> | ||
<Username | ||
user={{ | ||
userName: _id, | ||
countryCode, | ||
isSupporter: badges?.supporter || false, | ||
isVerified: badges?.verified || false, | ||
}} | ||
sx={{ alignSelf: 'flex-start' }} | ||
isLink={false} | ||
/> | ||
<Category | ||
category={{ label: 'Wants to get started' }} | ||
sx={{ | ||
border: '1px solid #A72E5A', | ||
backgroundColor: '#F7C7D9', | ||
color: '#A72E5A', | ||
}} | ||
/> | ||
</Flex> | ||
</Flex> | ||
) | ||
} |
86 changes: 86 additions & 0 deletions
86
packages/components/src/CardListItem/CardDetailsSpaceProfile.tsx
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,86 @@ | ||
import { Flex, Image, Text } from 'theme-ui' | ||
|
||
import { Category } from '../Category/Category' | ||
import { MemberBadge } from '../MemberBadge/MemberBadge' | ||
import { Username } from '../Username/Username' | ||
|
||
import type { IProfileCreator } from './types' | ||
|
||
interface IProps { | ||
creator: IProfileCreator | ||
} | ||
|
||
export const CardDetailsSpaceProfile = ({ creator }: IProps) => { | ||
const { _id, about, badges, countryCode, coverImage, profileType, subType } = | ||
creator | ||
|
||
const aboutTextStart = | ||
about && about.length > 80 ? about.slice(0, 78) + '...' : false | ||
|
||
return ( | ||
<Flex sx={{ flexDirection: 'column', width: '100%' }}> | ||
{coverImage && ( | ||
<Flex sx={{ flexDirection: 'column' }}> | ||
<Flex sx={{ aspectRatio: 16 / 6, overflow: 'hidden' }}> | ||
<Image | ||
src={coverImage} | ||
sx={{ | ||
aspectRatio: 16 / 6, | ||
alignSelf: 'stretch', | ||
objectFit: 'cover', | ||
}} | ||
/> | ||
</Flex> | ||
<MemberBadge | ||
profileType={profileType} | ||
size={40} | ||
sx={{ | ||
alignSelf: 'flex-end', | ||
transform: 'translateY(-20px)', | ||
marginX: 2, | ||
}} | ||
/> | ||
</Flex> | ||
)} | ||
<Flex | ||
sx={{ | ||
alignItems: 'flex-start', | ||
flexDirection: 'column', | ||
gap: 1, | ||
transform: coverImage ? 'translateY(-20px)' : '', | ||
paddingX: 2, | ||
paddingY: coverImage ? 0 : 2, | ||
}} | ||
> | ||
<Flex sx={{ gap: 2 }}> | ||
{!coverImage && <MemberBadge profileType={profileType} size={30} />} | ||
<Username | ||
user={{ | ||
userName: _id, | ||
countryCode, | ||
isVerified: badges?.verified || false, | ||
isSupporter: badges?.supporter || false, | ||
}} | ||
sx={{ alignSelf: 'flex-start' }} | ||
isLink={false} | ||
/> | ||
</Flex> | ||
{subType && ( | ||
<Category | ||
category={{ label: 'Wants to get started' }} | ||
sx={{ | ||
border: '1px solid #0087B6', | ||
backgroundColor: '#ECFAFF', | ||
color: '#0087B6', | ||
}} | ||
/> | ||
)} | ||
{about && ( | ||
<Text variant="quiet" sx={{ fontSize: 2 }}> | ||
{aboutTextStart || about} | ||
</Text> | ||
)} | ||
</Flex> | ||
</Flex> | ||
) | ||
} |
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.