Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: add maximum width to tooltips of form components and errors #133

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/design-system/src/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
className?: ColorPickerClassName
}

function useOutsideAlerter(elementRef: any, callback: () => void) {

Check failure on line 61 in packages/design-system/src/ColorPicker.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
useEffect(() => {
function handleClickOutside(event: any) {

Check failure on line 63 in packages/design-system/src/ColorPicker.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
if (elementRef.current && !elementRef.current.contains(event.target)) {
callback()
}
Expand Down Expand Up @@ -229,7 +229,11 @@
)}
</div>
{error && isTouched && (
<Tooltip tooltip={error} delay={0} className={{ tooltip: 'text-sm' }}>
<Tooltip
tooltip={error}
delay={0}
className={{ tooltip: 'max-w-[30rem] text-sm' }}
>
<FontAwesomeIcon
icon={faCircleExclamation}
className="mr-1 text-red-600"
Expand Down
6 changes: 5 additions & 1 deletion packages/design-system/src/DateChanger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ export function DateChanger({
</div>
)}
{error && !hideError && isTouched && (
<Tooltip tooltip={error} delay={0} className={{ tooltip: 'text-sm' }}>
<Tooltip
tooltip={error}
delay={0}
className={{ tooltip: 'max-w-[30rem] text-sm' }}
>
<FontAwesomeIcon
icon={faCircleExclamation}
className="mr-1 text-red-600"
Expand Down
5 changes: 4 additions & 1 deletion packages/design-system/src/FormLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export function FormLabel({
labelType === 'small' && '-mb-0.5 mt-1 leading-6 text-gray-600',
className?.label
),
tooltip: twMerge('text-sm font-normal', className?.tooltip),
tooltip: twMerge(
'max-w-[30rem] text-sm font-normal',
className?.tooltip
),
tooltipSymbol: twMerge(labelType === 'small' && 'h-2 w-2'),
}}
tooltip={tooltip}
Expand Down
6 changes: 5 additions & 1 deletion packages/design-system/src/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ export function Switch({
/>
)}
{error && !hideError && (
<Tooltip tooltip={error} delay={0} className={{ tooltip: 'text-sm' }}>
<Tooltip
tooltip={error}
delay={0}
className={{ tooltip: 'max-w-[30rem] text-sm' }}
>
<FontAwesomeIcon
icon={faCircleExclamation}
className="-mx-2 text-red-600"
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/Workflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export function WorkflowItem({
tooltip={tooltip}
delay={1500}
className={{
tooltip: 'z-20',
tooltip: 'z-20 max-w-[30rem]',
trigger: '!w-full',
}}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/forms/FormikDateField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function FormikDateField({
<Tooltip
tooltip={meta.error}
delay={0}
className={{ tooltip: 'text ml-3' }}
className={{ tooltip: 'text ml-3 max-w-[30rem]' }}
>
<FontAwesomeIcon
icon={faCircleExclamation}
Expand Down
6 changes: 5 additions & 1 deletion packages/design-system/src/forms/NumberField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ export function NumberField({
{...props}
/>
{error && !hideError && isTouched && (
<Tooltip tooltip={error} delay={0} className={{ tooltip: 'text-sm' }}>
<Tooltip
tooltip={error}
delay={0}
className={{ tooltip: 'max-w-[30rem] text-sm' }}
>
<FontAwesomeIcon
icon={faCircleExclamation}
className="mr-1 text-red-600"
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/forms/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function SelectField({
<Tooltip
tooltip={error}
delay={0}
className={{ tooltip: 'text-sm' }}
className={{ tooltip: 'max-w-[30rem] text-sm' }}
>
<FontAwesomeIcon
icon={faCircleExclamation}
Expand Down
6 changes: 5 additions & 1 deletion packages/design-system/src/forms/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ export function TextField({
)}
</div>
{error && !hideError && isTouched && (
<Tooltip tooltip={error} delay={0} className={{ tooltip: 'text-sm' }}>
<Tooltip
tooltip={error}
delay={0}
className={{ tooltip: 'max-w-[30rem] text-sm' }}
>
<FontAwesomeIcon
icon={faCircleExclamation}
className="mr-1 text-red-600"
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/forms/TextareaField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export function TextareaField({
<Tooltip
tooltip={error}
delay={0}
className={{ tooltip: 'text-sm' }}
className={{ tooltip: 'max-w-[30rem] text-sm' }}
>
<FontAwesomeIcon
icon={faCircleExclamation}
Expand Down
Loading