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
- Loading branch information
Showing
12 changed files
with
149 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
|
||
&__tags { | ||
margin-right: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
@media (min-width: 768px) { | ||
|
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
31 changes: 31 additions & 0 deletions
31
packages/ui/src/components/Catalog/Tags/CatalogClickableTag.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,31 @@ | ||
import { Label, Tooltip } from '@patternfly/react-core'; | ||
import { FunctionComponent } from 'react'; | ||
import { getTagColor } from './tag-color-resolver'; | ||
|
||
interface ICatalogCickableTagProps { | ||
tagName: string; | ||
className?: string; | ||
onTagClick: (_event: unknown, value: string) => void; | ||
} | ||
|
||
export const CatalogCickableTag: FunctionComponent<ICatalogCickableTagProps> = (props) => { | ||
return ( | ||
<Tooltip content={<span>Add to filter</span>}> | ||
<Label | ||
isCompact | ||
className={props.className ?? ''} | ||
color={getTagColor(props.tagName)} | ||
onClick={(ev) => { | ||
ev.stopPropagation(); // ignore root click, e.g. click on tile | ||
props.onTagClick(ev, props.tagName); | ||
}} | ||
render={({ className, content }) => ( | ||
// to force PF to render label as button with animation | ||
<a className={className}>{content}</a> | ||
)} | ||
> | ||
{props.tagName} | ||
</Label> | ||
</Tooltip> | ||
); | ||
}; |
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,22 @@ | ||
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'; | ||
} | ||
|
||
export const CatalogTag: FunctionComponent<ICatalogTagProps> = (props) => { | ||
return ( | ||
<Label | ||
isCompact | ||
className={props.className ?? ''} | ||
variant={props.variant ?? 'filled'} | ||
color={getTagColor(props.tag)} | ||
> | ||
{props.tag} | ||
</Label> | ||
); | ||
}; |
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 './CatalogClickableTag'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,5 +29,6 @@ | |
&__tags { | ||
margin-right: 1px; | ||
margin-left: 1px; | ||
cursor: pointer; | ||
} | ||
} |
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