-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RHOAIENG-5489] Home page: projects w/ tiles
- Loading branch information
1 parent
d155ef5
commit 2ae6e4e
Showing
11 changed files
with
464 additions
and
45 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
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,32 @@ | ||
import * as React from 'react'; | ||
import { Gallery, GalleryProps } from '@patternfly/react-core'; | ||
|
||
type EvenlySpacedGalleryProps = Omit<GalleryProps, 'minWidths' | 'maxWidths'> & { | ||
minSize?: string; | ||
itemCount: number; | ||
}; | ||
|
||
const EvenlySpacedGallery: React.FC<EvenlySpacedGalleryProps> = ({ | ||
minSize, | ||
itemCount, | ||
hasGutter, | ||
children, | ||
...rest | ||
}) => { | ||
const galleryWidths = `calc(${100 / itemCount}%${ | ||
hasGutter ? ` - (1rem * ${itemCount - 1} / ${itemCount})` : '' | ||
})`; | ||
|
||
return ( | ||
<Gallery | ||
hasGutter={hasGutter} | ||
minWidths={{ default: minSize || galleryWidths }} | ||
maxWidths={{ default: galleryWidths }} | ||
{...rest} | ||
> | ||
{children} | ||
</Gallery> | ||
); | ||
}; | ||
|
||
export default EvenlySpacedGallery; |
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,25 @@ | ||
import React from 'react'; | ||
import { Tooltip } from '@patternfly/react-core'; | ||
|
||
type TruncatedTextProps = { | ||
maxLines: number; | ||
content: string; | ||
} & React.HTMLProps<HTMLSpanElement>; | ||
|
||
const TruncatedText: React.FC<TruncatedTextProps> = ({ maxLines, content, ...rest }) => ( | ||
<Tooltip content={content}> | ||
<span | ||
style={{ | ||
display: '-webkit-box', | ||
overflow: 'hidden', | ||
WebkitBoxOrient: 'vertical', | ||
WebkitLineClamp: maxLines, | ||
}} | ||
{...rest} | ||
> | ||
{content} | ||
</span> | ||
</Tooltip> | ||
); | ||
|
||
export default TruncatedText; |
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,63 @@ | ||
import * as React from 'react'; | ||
import { | ||
Bullseye, | ||
Button, | ||
CardBody, | ||
Flex, | ||
FlexItem, | ||
Text, | ||
TextContent, | ||
} from '@patternfly/react-core'; | ||
import { ProjectObjectType, SectionType, typedObjectImage } from '~/concepts/design/utils'; | ||
import TypeBorderedCard from '~/concepts/design/TypeBorderedCard'; | ||
|
||
interface CreateProjectCardProps { | ||
allowCreate: boolean; | ||
onCreateProject: () => void; | ||
} | ||
|
||
const CreateProjectCard: React.FC<CreateProjectCardProps> = ({ allowCreate, onCreateProject }) => ( | ||
<TypeBorderedCard | ||
data-testid={allowCreate ? 'create-project-card' : 'request-project-card'} | ||
sectionType={SectionType.organize} | ||
> | ||
<CardBody> | ||
<Bullseye> | ||
<Flex direction={{ default: 'column' }} alignItems={{ default: 'alignItemsCenter' }}> | ||
<FlexItem> | ||
<img | ||
src={typedObjectImage(ProjectObjectType.project)} | ||
alt="Add project" | ||
width={54} | ||
height={54} | ||
/> | ||
</FlexItem> | ||
{allowCreate ? ( | ||
<FlexItem> | ||
<Button variant="link" isInline onClick={onCreateProject}> | ||
Create project | ||
</Button> | ||
</FlexItem> | ||
) : ( | ||
<> | ||
<FlexItem> | ||
<TextContent> | ||
<Text component="h3">Need another project?</Text> | ||
</TextContent> | ||
</FlexItem> | ||
<FlexItem> | ||
<TextContent> | ||
<Text component="small" style={{ textAlign: 'center' }}> | ||
Contact your administrator to request a project creation for you. | ||
</Text> | ||
</TextContent> | ||
</FlexItem> | ||
</> | ||
)} | ||
</Flex> | ||
</Bullseye> | ||
</CardBody> | ||
</TypeBorderedCard> | ||
); | ||
|
||
export default CreateProjectCard; |
Oops, something went wrong.