Skip to content

Commit 46fdd20

Browse files
committed
feat: update label color for row layout
1 parent 599af62 commit 46fdd20

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/Shared/Components/FormFieldWrapper/FormFieldLabel.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import { FormFieldLabelProps } from './types'
22
import { getFormLabelElementId } from './utils'
33

4-
const FormFieldLabel = ({ label, inputId, required }: FormFieldLabelProps) => {
4+
const FormFieldLabel = ({ label, inputId, required, layout }: FormFieldLabelProps) => {
55
if (!label) {
66
return null
77
}
88

99
const labelId = getFormLabelElementId(inputId)
10+
const isRowLayout = layout === 'row'
1011

1112
return (
12-
<label className="fs-13 lh-20 cn-7 fw-4 dc__block mb-0" htmlFor={inputId} id={labelId} data-testid={labelId}>
13+
<label
14+
className={`fs-13 lh-20 fw-4 dc__block mb-0 ${isRowLayout ? 'cn-9' : 'cn-7'}`}
15+
htmlFor={inputId}
16+
id={labelId}
17+
data-testid={labelId}
18+
>
1319
{typeof label === 'string' ? (
1420
<span className={`flex left ${required ? 'dc__required-field' : ''}`}>
1521
<span className="dc__truncate">{label}</span>

src/Shared/Components/FormFieldWrapper/FormFieldWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const FormFieldWrapper = ({
2121
<div className={`flex left top dc__gap-6 ${!isRowLayout ? 'column' : ''} w-100`}>
2222
{label && (
2323
<div className={`${itemContainerClassName} flex left`}>
24-
<FormFieldLabel inputId={inputId} label={label} required={required} />
24+
<FormFieldLabel inputId={inputId} label={label} required={required} layout={layout} />
2525
</div>
2626
)}
2727
<div className="w-100">{children}</div>

src/Shared/Components/FormFieldWrapper/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export type FormFieldLabelProps = LabelOrAriaLabelType & {
1919
* Id of the input element
2020
*/
2121
inputId: string
22+
/**
23+
* Layout of the field
24+
*/
25+
layout?: 'row' | 'column'
2226
}
2327

2428
export interface FormFieldInfoProps extends Pick<FormFieldLabelProps, 'inputId'> {
@@ -44,12 +48,8 @@ export interface FormInfoItemProps {
4448
}
4549

4650
export interface FormFieldWrapperProps
47-
extends Pick<FormFieldLabelProps, 'label' | 'required' | 'ariaLabel'>,
51+
extends Pick<FormFieldLabelProps, 'label' | 'required' | 'ariaLabel' | 'layout'>,
4852
FormFieldInfoProps {
49-
/**
50-
* Layout of the field
51-
*/
52-
layout?: 'row' | 'column'
5353
/**
5454
* If true, the field takes the full width of the parent
5555
*/

0 commit comments

Comments
 (0)