Skip to content

Commit effe5ef

Browse files
Update FormGroupLayoutLabel.tsx
I have made the following changes to improve the working label: 1. added stop propagation() on onClick to avoid toggle the parent component 2. improve the "?" svg
1 parent 843ef52 commit effe5ef

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

src/lib/FormGroupLayoutLabel.tsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,35 @@ const FormGroupLayoutLabel = <T extends FieldValues>(props: FormGroupLayoutLabel
3030
const checkboxLayout = layout === "checkbox";
3131

3232
return (
33-
<>
34-
<Label check={checkboxLayout || switchLayout} for={fieldId}>
33+
<div onClick={(e) => e.stopPropagation()}>
34+
<Label check={checkboxLayout || switchLayout} for={fieldId} style={{ display: "flex", gap: 1 }}>
3535
{finalLabel}
3636
{tooltip && (
37-
<svg
38-
xmlns="http://www.w3.org/2000/svg"
39-
fill="none"
40-
viewBox="0 0 24 24"
41-
strokeWidth={1.5}
42-
stroke="currentColor"
43-
id={`Tooltip-${fieldId}`}
44-
className="tooltip--icon"
45-
>
46-
<path
47-
strokeLinecap="round"
48-
strokeLinejoin="round"
49-
d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"
50-
/>
51-
</svg>
37+
<svg
38+
xmlns="http://www.w3.org/2000/svg"
39+
fill="none"
40+
viewBox="0 0 24 24"
41+
strokeWidth="1.5"
42+
stroke="currentColor"
43+
id={`Tooltip-${fieldId}`}
44+
className="tooltip--icon"
45+
width="24"
46+
height="24"
47+
>
48+
<path
49+
strokeLinecap="round"
50+
strokeLinejoin="round"
51+
d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"
52+
/>
53+
</svg>
5254
)}
5355
</Label>
5456
{tooltip && (
5557
<UncontrolledTooltip placement="top" target={`Tooltip-${fieldId}`}>
5658
{tooltip}
5759
</UncontrolledTooltip>
5860
)}
59-
</>
61+
</div>
6062
);
6163
};
6264

0 commit comments

Comments
 (0)