Skip to content

Commit

Permalink
style: add maximum width to tooltips of form components and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sjschlapbach committed Sep 9, 2024
1 parent 9da4ff7 commit c596fa2
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 10 deletions.
6 changes: 5 additions & 1 deletion packages/design-system/src/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ export function ColorPicker({
)}
</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

0 comments on commit c596fa2

Please sign in to comment.