mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: handle long names in new project card footers (#7216)
This is a redo of #7215. I missed the case where you have multiple owners, causing it to lay out weird in that case. This version handles that by returning an empty div for the owners instead to fill up that space.   There **are** edge cases where the owners wrap:  But that is also the case with the current implementation:  And only happens at very specific breakpoints.
This commit is contained in:
		
							parent
							
								
									669e21eef0
								
							
						
					
					
						commit
						1ac447141a
					
				| @ -11,17 +11,17 @@ interface IProjectCardFooterProps { | ||||
| } | ||||
| 
 | ||||
| const StyledFooter = styled(Box)(({ theme }) => ({ | ||||
|     display: 'flex', | ||||
|     justifyContent: 'space-between', | ||||
|     display: 'grid', | ||||
|     gridTemplateColumns: 'auto 1fr auto', | ||||
|     alignItems: 'center', | ||||
|     padding: theme.spacing(1.5, 3), | ||||
|     padding: theme.spacing(1.5, 3, 2.5, 3), | ||||
|     background: theme.palette.envAccordion.expanded, | ||||
|     boxShadow: theme.boxShadows.accordionFooter, | ||||
| })); | ||||
| 
 | ||||
| const StyledFavoriteIconButton = styled(FavoriteIconButton)(({ theme }) => ({ | ||||
|     marginRight: theme.spacing(-1), | ||||
|     marginLeft: 'auto', | ||||
|     marginBottom: theme.spacing(-1), | ||||
| })); | ||||
| 
 | ||||
| export const ProjectCardFooter: FC<IProjectCardFooterProps> = ({ | ||||
|  | ||||
| @ -41,15 +41,13 @@ const useOwnersMap = () => { | ||||
|     }; | ||||
| }; | ||||
| 
 | ||||
| const StyledContainer = styled('div')(({ theme }) => ({ | ||||
|     marginBottom: theme.spacing(1), | ||||
|     display: 'flex', | ||||
|     alignItems: 'flex-end', | ||||
| })); | ||||
| 
 | ||||
| const StyledUserName = styled('p')(({ theme }) => ({ | ||||
|     fontSize: theme.typography.body1.fontSize, | ||||
|     margin: theme.spacing(0, 0, 0.5, 0), | ||||
|     overflowX: 'hidden', | ||||
|     textOverflow: 'ellipsis', | ||||
|     textWrap: 'nowrap', | ||||
|     alignSelf: 'end', | ||||
| })); | ||||
| 
 | ||||
| export const ProjectOwners: FC<IProjectOwnersProps> = ({ owners = [] }) => { | ||||
| @ -57,7 +55,7 @@ export const ProjectOwners: FC<IProjectOwnersProps> = ({ owners = [] }) => { | ||||
|     const users = owners.map(ownersMap); | ||||
| 
 | ||||
|     return ( | ||||
|         <StyledContainer> | ||||
|         <> | ||||
|             <GroupCardAvatars | ||||
|                 header={owners.length === 1 ? 'Owner' : 'Owners'} | ||||
|                 users={users} | ||||
| @ -69,7 +67,8 @@ export const ProjectOwners: FC<IProjectOwnersProps> = ({ owners = [] }) => { | ||||
|                         {users[0]?.name || users[0]?.description} | ||||
|                     </StyledUserName> | ||||
|                 } | ||||
|                 elseShow={<div />} | ||||
|             /> | ||||
|         </StyledContainer> | ||||
|         </> | ||||
|     ); | ||||
| }; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user