19 lines
425 B
TypeScript
19 lines
425 B
TypeScript
|
|
type Props = {
|
||
|
|
text: string;
|
||
|
|
label?: string;
|
||
|
|
};
|
||
|
|
|
||
|
|
export function HoverHelpTip({ text, label = "查看原因" }: Props) {
|
||
|
|
if (!text.trim()) return null;
|
||
|
|
|
||
|
|
return (
|
||
|
|
<span className="hx-hover-help">
|
||
|
|
<button type="button" className="hx-hover-help__trigger" aria-label={label}>
|
||
|
|
?
|
||
|
|
</button>
|
||
|
|
<span className="hx-hover-help__bubble" role="tooltip">
|
||
|
|
{text}
|
||
|
|
</span>
|
||
|
|
</span>
|
||
|
|
);
|
||
|
|
}
|