From fab4d837b1fa3103a1511c80c5bba91d4cb7f9a7 Mon Sep 17 00:00:00 2001 From: sjschlapbach Date: Thu, 15 Aug 2024 22:54:22 +0200 Subject: [PATCH] refactor: define unified form labels for all new formik fields --- packages/design-system/src/ColorPicker.tsx | 2 +- packages/design-system/src/DateChanger.tsx | 21 +++------ packages/design-system/src/FormLabel.tsx | 44 +++++++++++++++++++ .../src/forms/NewFormikColorPicker.tsx | 19 +++----- .../src/forms/NewFormikDateField.tsx | 18 +++----- .../design-system/src/forms/NumberField.tsx | 23 +++------- .../design-system/src/forms/SelectField.tsx | 19 +++----- .../design-system/src/forms/TextField.tsx | 23 +++------- .../design-system/src/forms/TextareaField.tsx | 23 +++------- packages/design-system/src/index.ts | 1 + 10 files changed, 88 insertions(+), 105 deletions(-) create mode 100644 packages/design-system/src/FormLabel.tsx diff --git a/packages/design-system/src/ColorPicker.tsx b/packages/design-system/src/ColorPicker.tsx index 319f4c64..d23789ba 100644 --- a/packages/design-system/src/ColorPicker.tsx +++ b/packages/design-system/src/ColorPicker.tsx @@ -142,7 +142,7 @@ export function ColorPicker({ label={colorLabel} className={{ root: twMerge( - 'my-auto -mb-1 min-w-max text-base font-bold leading-6 text-gray-600', + 'my-auto -mb-0.5 min-w-max text-base font-bold leading-6 text-gray-600', className?.inputLabel ), tooltip: twMerge( diff --git a/packages/design-system/src/DateChanger.tsx b/packages/design-system/src/DateChanger.tsx index a4405cbb..57c16956 100644 --- a/packages/design-system/src/DateChanger.tsx +++ b/packages/design-system/src/DateChanger.tsx @@ -8,7 +8,7 @@ import dayjs from 'dayjs' import React, { useEffect, useRef, useState } from 'react' import { twMerge } from 'tailwind-merge' import Button from './Button' -import Label from './forms/Label' +import FormLabel from './FormLabel' import { Tooltip } from './Tooltip' export interface DateChangerClassName { @@ -77,7 +77,7 @@ export function DateChanger({ data, dataButton, label = '', - labelType = 'large', + labelType = 'small', tooltip, required = false, disabled = false, @@ -110,22 +110,13 @@ export function DateChanger({ )} > {label && ( -