-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RHOAIENG-5489] Home page: projects w/ tiles #2741
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; |
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; |
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> | ||
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. This font size looks really large relative to other contents on the page. One suggestion here is to use the
When I look at the current design document, the |
||
</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; |
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.
Ah interesting -- FWIW, if you provide
style
inrest
you'll lose the primary purpose of the component