This repository has been archived by the owner on Feb 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Lakehead - CEM-2602 Profile list with counter #423
Open
percypie
wants to merge
5
commits into
master
Choose a base branch
from
CEM-2602
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9148b9a
Functions but does not adjust position dynamically
percypie cb8190c
Implemented the counter on the existing component
percypie 15feb92
Added a boolean that can be turned on to display counter
percypie 26ae7e1
meeting fixes
percypie 6f34cb1
Changed counterBool to isCounterShowing
percypie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,13 @@ export interface IProfile { | |
|
||
export interface IFeaturedProfilesCardProps { | ||
profileData: IProfile[]; | ||
counterBool: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation of Props goes here not on the component. You are doucmenting the type |
||
} | ||
|
||
export const FeaturedProfilesCard: React.FC<IFeaturedProfilesCardProps> = ({ | ||
profileData, | ||
profileData, //the array of profiles to be displayed | ||
counterBool, //if true, the profile counter is displayed, and if false, the counter is not displayed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. docs should not be on this line, put in TypeScript |
||
...props | ||
}): React.ReactElement => { | ||
const renderProfileCircles = useCallback(() => { | ||
const determineProfilePictureLimit = () => { | ||
|
@@ -56,32 +59,27 @@ export const FeaturedProfilesCard: React.FC<IFeaturedProfilesCardProps> = ({ | |
profile: IProfile, | ||
index: number, | ||
): React.ReactElement => { | ||
const featuredProfileProps = { | ||
key: profile.id, | ||
background: 'none' | ||
}; | ||
|
||
switch (true) { | ||
case index < determineProfilePictureLimit(): | ||
return ( | ||
<FeaturedProfile | ||
key={profile.id} | ||
image={profile.image} | ||
background="none" | ||
/> | ||
); | ||
featuredProfileProps['image'] = profile.image; | ||
|
||
case index < profileInitialsEndIndex: | ||
return ( | ||
<FeaturedProfile | ||
key={profile.id} | ||
initials={profile.initials} | ||
background="orange" | ||
/> | ||
); | ||
featuredProfileProps['initials'] = profile.initials; | ||
featuredProfileProps['background'] = "orange"; | ||
|
||
default: | ||
return ( | ||
<FeaturedProfile | ||
key={profile.id} | ||
remainingProfiles={remainingProfiles} | ||
background="gray" | ||
/> | ||
); | ||
featuredProfileProps['remainingProfiles'] = {remainingProfiles}; | ||
featuredProfileProps['background'] = "gray"; | ||
} | ||
|
||
return ( | ||
<FeaturedProfile {...featuredProfileProps}/> | ||
) | ||
}; | ||
|
||
return profiles.map( | ||
|
@@ -90,14 +88,19 @@ export const FeaturedProfilesCard: React.FC<IFeaturedProfilesCardProps> = ({ | |
}, [profileData]); | ||
|
||
return ( | ||
<Container> | ||
{renderProfileCircles()} | ||
<FeaturedProfile icon key={ADD_USER_ICON_KEY} background="grey" /> | ||
</Container> | ||
<Holder> | ||
<Container> | ||
{renderProfileCircles()} | ||
<FeaturedProfile icon key={ADD_USER_ICON_KEY} background="grey" /> | ||
</Container> | ||
{counterBool && <CountContainer>{profileData.length}</CountContainer>} | ||
</Holder> | ||
|
||
); | ||
}; | ||
|
||
const Container = styled.ul` | ||
|
||
${flex('row')} | ||
padding: 5px; | ||
|
||
|
@@ -120,3 +123,13 @@ const Container = styled.ul` | |
z-index: -3; | ||
} | ||
`; | ||
|
||
const CountContainer = styled.div` | ||
font-size 40px; | ||
height 150px; | ||
line-height 150px; | ||
text-align:center; | ||
` | ||
const Holder = styled.div` | ||
display: 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't put Types in the Name
We dont say NameString, we just say Name.
Rename this to isCounterShowing or isCounterDisplayed or isProfileCountShowing
the prefix is denotes a Boolean value