diff --git a/src/lib/kit/components/LongValue/LongValue.scss b/src/lib/kit/components/LongValue/LongValue.scss index 14a090ed..a54e690d 100644 --- a/src/lib/kit/components/LongValue/LongValue.scss +++ b/src/lib/kit/components/LongValue/LongValue.scss @@ -16,5 +16,11 @@ &:hover { color: var(--g-color-text-secondary); } + + &.#{$ns}long-value_secondary { + &:hover { + color: var(--g-color-text-primary); + } + } } } diff --git a/src/lib/kit/components/LongValue/LongValue.tsx b/src/lib/kit/components/LongValue/LongValue.tsx index 4c4e00b3..3f8faadf 100644 --- a/src/lib/kit/components/LongValue/LongValue.tsx +++ b/src/lib/kit/components/LongValue/LongValue.tsx @@ -15,7 +15,12 @@ export interface LongValueProps extends TextProps { onClick?: (e: React.MouseEvent) => void; } -export const LongValue: React.FC = ({value, onClick, className, ...restProps}) => { +export const LongValue: React.FC = ({ + value, + onClick, + className: externalClassName, + ...restProps +}) => { const ref = React.useRef(null); const [open, setOpen] = React.useState(false); const [long, setLong] = React.useState(false); @@ -28,6 +33,19 @@ export const LongValue: React.FC = ({value, onClick, className, [setOpen, onClick], ); + const className = React.useMemo( + () => + b( + { + open, + long, + ...(restProps.color ? {[restProps.color]: true} : {}), + }, + externalClassName, + ), + [open, long, externalClassName, restProps.color], + ); + React.useEffect(() => { if (ref.current) { const {offsetWidth, scrollWidth} = ref.current;