forked from KaotoIO/kaoto
-
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.
feat(KaotoIOgh-115): Tag filtering in catalog
* feat(KaotoIOgh-121) Wrap tags in tile component
- Loading branch information
Showing
16 changed files
with
386 additions
and
186 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
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
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,24 @@ | ||
import { Label } from '@patternfly/react-core'; | ||
import { FunctionComponent } from 'react'; | ||
import { getTagColor } from './tag-color-resolver'; | ||
|
||
interface ICatalogTagProps { | ||
tag: string; | ||
className?: string; | ||
variant?: 'outline' | 'filled'; | ||
textMaxWidth?: string; | ||
} | ||
|
||
export const CatalogTag: FunctionComponent<ICatalogTagProps> = (props) => { | ||
return ( | ||
<Label | ||
textMaxWidth={props.textMaxWidth ?? undefined} | ||
isCompact | ||
className={props.className ?? ''} | ||
variant={props.variant ?? 'filled'} | ||
color={getTagColor(props.tag)} | ||
> | ||
{props.tag} | ||
</Label> | ||
); | ||
}; |
33 changes: 33 additions & 0 deletions
33
packages/ui/src/components/Catalog/Tags/CatalogTagsPanel.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Label, LabelGroup } from '@patternfly/react-core'; | ||
import { FunctionComponent } from 'react'; | ||
import { getTagColor } from './tag-color-resolver'; | ||
|
||
interface ICatalogTagsPanelProps { | ||
tags: string[]; | ||
onTagClick: (_event: unknown, value: string) => void; | ||
} | ||
|
||
export const CatalogTagsPanel: FunctionComponent<ICatalogTagsPanelProps> = (props) => { | ||
return ( | ||
<LabelGroup isCompact aria-label="data-list-item-tags"> | ||
{props.tags.map((tag) => ( | ||
<Label | ||
isCompact | ||
key={tag} | ||
data-testid={'tag-' + tag} | ||
color={getTagColor(tag)} | ||
onClick={(ev) => { | ||
ev.stopPropagation(); // ignore root click, e.g. click on tile | ||
props.onTagClick(ev, tag); | ||
}} | ||
render={({ className, content }) => ( | ||
// to force PF to render label as button with animation | ||
<a className={className}>{content}</a> | ||
)} | ||
> | ||
{tag} | ||
</Label> | ||
))} | ||
</LabelGroup> | ||
); | ||
}; |
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 './tag-color-resolver'; | ||
export * from './CatalogTag'; | ||
export * from './CatalogTagsPanel'; |
File renamed without changes.
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
Oops, something went wrong.