forked from konveyor/tackle2-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Extract IconWithLabel component (konveyor#1878)
Resolves: konveyor#1873 --------- Signed-off-by: Radoslaw Szwajkowski <[email protected]>
- Loading branch information
1 parent
e4c5a86
commit b348109
Showing
14 changed files
with
88 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { FC, ReactElement, ReactNode } from "react"; | ||
import { Flex, FlexItem } from "@patternfly/react-core"; | ||
import { OptionalTooltip } from "./OptionalTooltip"; | ||
|
||
export const IconWithLabel: FC<{ | ||
iconTooltipMessage?: string; | ||
icon: ReactElement; | ||
label: ReactNode; | ||
trailingItem?: ReactElement; | ||
trailingItemTooltipMessage?: string; | ||
}> = ({ | ||
iconTooltipMessage, | ||
icon, | ||
label, | ||
trailingItem, | ||
trailingItemTooltipMessage, | ||
}) => ( | ||
<Flex | ||
flexWrap={{ default: "nowrap" }} | ||
spaceItems={{ default: "spaceItemsSm" }} | ||
> | ||
<FlexItem> | ||
<OptionalTooltip tooltipMessage={iconTooltipMessage}> | ||
{icon} | ||
</OptionalTooltip> | ||
</FlexItem> | ||
<FlexItem>{label}</FlexItem> | ||
{!!trailingItem && ( | ||
<FlexItem> | ||
<OptionalTooltip tooltipMessage={trailingItemTooltipMessage}> | ||
{trailingItem} | ||
</OptionalTooltip> | ||
</FlexItem> | ||
)} | ||
</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
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,12 @@ | ||
import React from "react"; | ||
import { Tooltip } from "@patternfly/react-core"; | ||
|
||
export const OptionalTooltip: React.FC<{ | ||
tooltipMessage?: string; | ||
children: React.ReactElement; | ||
}> = ({ children, tooltipMessage }) => | ||
tooltipMessage ? ( | ||
<Tooltip content={tooltipMessage}>{children}</Tooltip> | ||
) : ( | ||
<>{children}</> | ||
); |
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,3 @@ | ||
export * from "./OptionalTooltip"; | ||
export * from "./IconedStatus"; | ||
export * from "./IconWithLabel"; |
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
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
2 changes: 1 addition & 1 deletion
2
client/src/app/pages/applications/components/application-analysis-status.tsx
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
2 changes: 1 addition & 1 deletion
2
...s/applications/components/application-assessment-status/application-assessment-status.tsx
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
2 changes: 1 addition & 1 deletion
2
...app/pages/applications/components/application-review-status/application-review-status.tsx
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
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