diff --git a/package.json b/package.json
index 7e4e9c35..0dfc55a2 100644
--- a/package.json
+++ b/package.json
@@ -156,4 +156,4 @@
"eslint --fix --ext ts,tsx,js,jsx"
]
}
-}
\ No newline at end of file
+}
diff --git a/src/components/CatalogCard.tsx b/src/components/CatalogCard.tsx
index 9cdf70b8..5008783e 100644
--- a/src/components/CatalogCard.tsx
+++ b/src/components/CatalogCard.tsx
@@ -109,7 +109,7 @@ function CatalogCardRef(
{(category || tags?.length > 0) && (
@@ -118,6 +118,7 @@ function CatalogCardRef(
size="small"
border="none"
fillLevel={3}
+ truncateWidth={70}
>
{category}
@@ -128,8 +129,7 @@ function CatalogCardRef(
fillLevel={3}
values={tags ?? []}
limit={1}
- truncateWidth={100}
- wrap="nowrap"
+ truncateWidth={70}
emptyState={null}
/>
diff --git a/src/components/ChipList.tsx b/src/components/ChipList.tsx
index 7a19e34e..7fb54dd3 100644
--- a/src/components/ChipList.tsx
+++ b/src/components/ChipList.tsx
@@ -1,15 +1,13 @@
-import { Flex, type FlexBaseProps, Span } from 'honorable'
import isEmpty from 'lodash-es/isEmpty'
import {
type ComponentProps,
type Dispatch,
type ReactElement,
- useState,
+ useCallback,
} from 'react'
-import { HamburgerMenuCollapseIcon } from '../icons'
-
import Chip, { type ChipProps } from './Chip'
+import Flex from './Flex'
type TransformFn = (
value: TValue
@@ -19,7 +17,6 @@ export type ChipListProps = {
values: TValue[]
transformValue?: TransformFn
limit: number
- wrap?: Pick
emptyState?: JSX.Element | null
onClickCondition?: (value: TValue) => boolean
onClick?: Dispatch
@@ -29,60 +26,51 @@ function ChipList({
values = [],
transformValue,
limit = 4,
- wrap = 'wrap',
emptyState,
onClickCondition,
onClick,
...props
}: ChipListProps): ReactElement {
- const [collapsed, setCollapsed] = useState(true)
+ const chip = useCallback(
+ (v: TValue, i: number) => {
+ const clickable = onClickCondition?.(v) ?? false
+
+ return (
+ clickable && onClick(v)}
+ {...props}
+ >
+ {transformValue ? transformValue(v) : `${v}`}
+
+ )
+ },
+ [onClick, onClickCondition, props, transformValue]
+ )
return (
{isEmpty(values) &&
- (emptyState !== undefined ? (
- emptyState
- ) : (
- There is nothing to display here.
- ))}
- {values.slice(0, collapsed ? limit : undefined).map((v, i) => {
- const clickable = onClickCondition?.(v) ?? false
-
- return (
- clickable && onClick(v)}
- {...props}
- >
- {transformValue ? transformValue(v) : `${v}`}
-
- )
- })}
+ (emptyState !== undefined
+ ? emptyState
+ : 'There is nothing to display here.')}
+ {values.slice(0, limit).map(chip)}
{values.length > limit && (
- <>
- {collapsed && (
- setCollapsed(false)}
- {...props}
- clickable
- >
- {`+${values.length - limit}`}
-
- )}
- {!collapsed && (
- setCollapsed(true)}
- {...props}
- clickable
+
-
-
- )}
- >
+ {values.slice(limit, values.length).map(chip)}
+
+ }
+ >{`+${values.length - limit}`}
)}
)