mirror of
https://github.com/Lifeforge-app/lifeforge.git
synced 2026-06-27 14:26:06 +00:00
refactor(ui): replace Tooltip iconClassName with iconProps
Replace the string-only iconClassName prop on the Tooltip component with a full iconProps object, allowing consumers to pass any Icon prop (color, size, etc.) instead of relying on Tailwind class names.
This commit is contained in:
@@ -143,7 +143,9 @@ export const ErrorTooltip: Story = {
|
||||
</>
|
||||
),
|
||||
icon: 'tabler:alert-circle',
|
||||
iconClassName: 'text-red-500',
|
||||
iconProps: {
|
||||
color: 'red-500'
|
||||
},
|
||||
id: 'error-tooltip'
|
||||
},
|
||||
render: args => (
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ from 'lodash'
|
||||
import { Tooltip as ReactTooltip } from 'react-tooltip'
|
||||
import tinycolor from 'tinycolor2'
|
||||
|
||||
import { Box, Icon, Text } from '@/components/primitives'
|
||||
import { Box, Icon, type IconProps, Text } from '@/components/primitives'
|
||||
import { usePersonalization } from '@/providers'
|
||||
|
||||
/**
|
||||
@@ -12,7 +12,7 @@ import { usePersonalization } from '@/providers'
|
||||
export function Tooltip({
|
||||
id,
|
||||
icon,
|
||||
iconClassName,
|
||||
iconProps,
|
||||
children,
|
||||
...tooltipProps
|
||||
}: {
|
||||
@@ -21,7 +21,7 @@ export function Tooltip({
|
||||
/** The icon to display as the tooltip trigger. Should be a valid icon name from Iconify. */
|
||||
icon: string
|
||||
/** Optional additional class name(s) to apply to the icon element. */
|
||||
iconClassName?: string
|
||||
iconProps?: Omit<IconProps, 'icon'>
|
||||
/** The content to display inside the tooltip when triggered. */
|
||||
children: React.ReactNode
|
||||
/** Additional properties to pass to the underlying ReactTooltip component. */
|
||||
@@ -31,7 +31,7 @@ export function Tooltip({
|
||||
return (
|
||||
<>
|
||||
<span data-tooltip-id={`tooltip-${_.kebabCase(id)}`}>
|
||||
<Icon className={iconClassName ?? ''} color="muted" icon={icon} />
|
||||
<Icon color="muted" icon={icon} {...iconProps} />
|
||||
</span>
|
||||
<Box
|
||||
asChild
|
||||
|
||||
Reference in New Issue
Block a user