Skip to content

Commit

Permalink
Allow sending action which is rendered next to tile title
Browse files Browse the repository at this point in the history
  • Loading branch information
karelhala committed Feb 16, 2024
1 parent 96d9f8c commit baa2529
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/module/src/catalog/QuickStartTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ interface QuickStartTileProps {
status: QuickStartStatus;
isActive: boolean;
onClick?: () => void;
action?: React.ReactNode;
}

const QuickStartTile: React.FC<QuickStartTileProps> = ({
quickStart,
status,
isActive,
onClick = () => {},
action
}) => {
const {
metadata: { name: id },
Expand Down Expand Up @@ -92,6 +94,7 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
duration={durationMinutes}
type={type}
quickStartId={id}
action={action}
/>
}
onClick={handleClick}
Expand Down
5 changes: 5 additions & 0 deletions packages/module/src/catalog/QuickStartTileHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
& .pf-v5-c-badge:not(:last-of-type) {
margin-right: var(--pf-v5-global--spacer--sm);
}

.pfext-quick-start-title-header__display-name {
display: flex;
justify-content: center;
}
}
11 changes: 8 additions & 3 deletions packages/module/src/catalog/QuickStartTileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface QuickStartTileHeaderProps {
name: string;
type?: QuickStartType;
quickStartId?: string;
action?: React.ReactNode;
}

const statusColorMap = {
Expand All @@ -27,6 +28,7 @@ const QuickStartTileHeader: React.FC<QuickStartTileHeaderProps> = ({
name,
type,
quickStartId,
action
}) => {
const { getResource } = React.useContext<QuickStartContextValues>(QuickStartContext);

Expand All @@ -38,9 +40,12 @@ const QuickStartTileHeader: React.FC<QuickStartTileHeaderProps> = ({

return (
<div className="pfext-quick-start-tile-header">
<Title headingLevel="h3" data-test="title" id={quickStartId}>
<QuickStartMarkdownView content={name} />
</Title>
<div className="pfext-quick-start-title-header__display-name">
<Title headingLevel="h3" data-test="title" id={quickStartId}>
<QuickStartMarkdownView content={name} />
</Title>
{action}
</div>
<div className="pfext-quick-start-tile-header__status">
{type && (
<Label className="pfext-quick-start-tile-header--margin" color={type.color}>
Expand Down

0 comments on commit baa2529

Please sign in to comment.