Skip to content

Commit

Permalink
use clsx instead of classnames for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sqs committed Feb 19, 2024
1 parent 5b757ed commit 884c12e
Show file tree
Hide file tree
Showing 3 changed files with 2,820 additions and 4,941 deletions.
2 changes: 1 addition & 1 deletion lib/ui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@opencodegraph/schema": "workspace:*",
"@opencodegraph/ui-standalone": "workspace:*",
"classnames": "^2.3.2"
"clsx": "^2.0.0"
},
"devDependencies": {
"@types/react": "18.2.37",
Expand Down
8 changes: 4 additions & 4 deletions lib/ui-react/src/itemChip/ItemChip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Item } from '@opencodegraph/schema'
import classNames from 'classnames'
import clsx from 'clsx'
import React, { useCallback, useRef, useState } from 'react'
import styles from './ItemChip.module.css'
import { Popover } from './Popover'
Expand All @@ -21,14 +21,14 @@ export const ItemChip: React.FunctionComponent<{
const anchorRef = useRef<HTMLElement>(null)

return (
<aside className={classNames(styles.item, hasDetail ? styles.itemHasDetail : null, className)} ref={anchorRef}>
<aside className={clsx(styles.item, hasDetail ? styles.itemHasDetail : null, className)} ref={anchorRef}>
<header onMouseEnter={showPopover} onMouseLeave={hidePopover} onFocus={showPopover} onBlur={hidePopover}>
<ItemTitle title={item.title} />
{item.url && <a className={styles.stretchedLink} aria-hidden={true} href={item.url} />}
</header>
{hasDetail && anchorRef.current && (
<Popover anchor={anchorRef.current} visible={popoverVisible}>
<aside className={classNames(styles.popoverContent, popoverClassName)}>
<aside className={clsx(styles.popoverContent, popoverClassName)}>
<ItemDetail title={item.title} detail={item.detail} image={item.image} />
</aside>
</Popover>
Expand Down Expand Up @@ -65,7 +65,7 @@ export const ItemChipList: React.FunctionComponent<{
chipClassName?: string
popoverClassName?: string
}> = ({ items, className, chipClassName, popoverClassName }) => (
<div className={classNames(styles.list, className)}>
<div className={clsx(styles.list, className)}>
{items.map(item => (
<ItemChip key={item.id} item={item} className={chipClassName} popoverClassName={popoverClassName} />
))}
Expand Down
Loading

0 comments on commit 884c12e

Please sign in to comment.