Skip to content

Commit 6d73640

Browse files
authored
feat: add styles for long value (#228)
1 parent d2e926b commit 6d73640

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/lib/kit/components/LongValue/LongValue.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,11 @@
1616
&:hover {
1717
color: var(--g-color-text-secondary);
1818
}
19+
20+
&.#{$ns}long-value_secondary {
21+
&:hover {
22+
color: var(--g-color-text-primary);
23+
}
24+
}
1925
}
2026
}

src/lib/kit/components/LongValue/LongValue.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ export interface LongValueProps extends TextProps {
1515
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
1616
}
1717

18-
export const LongValue: React.FC<LongValueProps> = ({value, onClick, className, ...restProps}) => {
18+
export const LongValue: React.FC<LongValueProps> = ({
19+
value,
20+
onClick,
21+
className: externalClassName,
22+
...restProps
23+
}) => {
1924
const ref = React.useRef<HTMLDivElement>(null);
2025
const [open, setOpen] = React.useState(false);
2126
const [long, setLong] = React.useState(false);
@@ -28,6 +33,19 @@ export const LongValue: React.FC<LongValueProps> = ({value, onClick, className,
2833
[setOpen, onClick],
2934
);
3035

36+
const className = React.useMemo(
37+
() =>
38+
b(
39+
{
40+
open,
41+
long,
42+
...(restProps.color ? {[restProps.color]: true} : {}),
43+
},
44+
externalClassName,
45+
),
46+
[open, long, externalClassName, restProps.color],
47+
);
48+
3149
React.useEffect(() => {
3250
if (ref.current) {
3351
const {offsetWidth, scrollWidth} = ref.current;

0 commit comments

Comments
 (0)