Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

Commit a50d25b

Browse files
authored
Merge pull request #841 from wyvl/technical/INT-13089-remove-label-suffix-on-form-field
[INT-13089] Remove label suffix on form field
2 parents d7b239e + 8fcd749 commit a50d25b

File tree

5 files changed

+1
-110
lines changed

5 files changed

+1
-110
lines changed

src/domain/Forms/VerticalForm/VerticalForm.examples.md

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -317,68 +317,3 @@ initialState = { textInputValue: '' };
317317
</VerticalForm.RightAlignControls>
318318
</VerticalForm>
319319
```
320-
321-
Field with label suffix
322-
323-
```jsx
324-
import { ButtonGroup, Button } from '@Domain/Buttons';
325-
import { SelectInput } from '@Domain/Inputs';
326-
327-
initialState = { people: [], parentGoalId: '' };
328-
329-
<VerticalForm
330-
>
331-
<VerticalForm.Field
332-
inputName='people'
333-
label='Set Goal for'
334-
>
335-
<SelectInput
336-
name='people'
337-
value={state.people}
338-
options={[
339-
{
340-
label: 'Lyanna Moreton',
341-
value: 1
342-
},
343-
{
344-
label: 'Donna Summer',
345-
value: 2
346-
}
347-
]}
348-
onChange={value => { value.length > 1 ? setState({ people: value, parentGoalId:'' }) : setState({ people: value }) }}
349-
isMultiSelect
350-
/>
351-
</VerticalForm.Field>
352-
<VerticalForm.Field
353-
inputName='parentGoalId'
354-
label='Parent Goal'
355-
labelSuffix='individuals only'
356-
tooltipMessage='Parent goals are related to an individual and cannot be selected for multiple people.'
357-
tooltipProps={{width: 300}}
358-
>
359-
<SelectInput
360-
isDisabled={state.people.length > 1}
361-
name='parentGoalId'
362-
value={state.parentGoalId}
363-
options={[
364-
{
365-
label: 'Sale Goal',
366-
value: 1
367-
},
368-
{
369-
label: 'IT Goal',
370-
value: 2
371-
}
372-
]}
373-
onChange={value => setState({ parentGoalId: value })}
374-
/>
375-
</VerticalForm.Field>
376-
<VerticalForm.RightAlignControls>
377-
<Button
378-
type='primary'
379-
>
380-
Submit me :)
381-
</Button>
382-
</VerticalForm.RightAlignControls>
383-
</VerticalForm>
384-
```

src/domain/Forms/VerticalForm/subcomponents/Field.test.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,4 @@ describe('<Field />', () => {
137137

138138
expect(wrapper).toMatchSnapshot()
139139
})
140-
141-
it(`should render a vertical form field with label suffix`, () => {
142-
const wrapper = shallow(
143-
<Field
144-
inputName='testInput'
145-
label='This is a test input'
146-
labelSuffix='only test'
147-
>
148-
Children
149-
</Field>
150-
)
151-
152-
expect(wrapper).toMatchSnapshot()
153-
})
154140
})

src/domain/Forms/VerticalForm/subcomponents/Field.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ interface IVerticalFormFieldProps {
2323
isRequired?: boolean
2424
/** Text displayed above the input */
2525
label?: string
26-
/** Arbitrary text displayed after the label, it will replace the required label when isRequired is true */
27-
labelSuffix?: string
2826
/** Descriptive text displayed above the input */
2927
description?: string
3028
/** action text link displayed below the input */
@@ -86,16 +84,14 @@ class Field extends React.PureComponent<IVerticalFormFieldProps, never> {
8684
const {
8785
inputName,
8886
isRequired,
89-
label,
90-
labelSuffix
87+
label
9188
} = this.props
9289

9390
if (label) {
9491
return (
9592
<StyledInputLabel
9693
htmlFor={inputName}
9794
isRequired={isRequired!}
98-
labelSuffix={labelSuffix}
9995
>
10096
{label}
10197
{this.tooltip}

src/domain/Forms/VerticalForm/subcomponents/__snapshots__/Field.test.tsx.snap

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,6 @@ exports[`<Field /> should render a vertical form field with error messages 1`] =
121121
</styled.div>
122122
`;
123123

124-
exports[`<Field /> should render a vertical form field with label suffix 1`] = `
125-
<styled.div>
126-
<styled.div>
127-
<styled.label
128-
htmlFor="testInput"
129-
isRequired={false}
130-
labelSuffix="only test"
131-
>
132-
This is a test input
133-
</styled.label>
134-
</styled.div>
135-
Children
136-
</styled.div>
137-
`;
138-
139124
exports[`<Field /> should render a vertical form field with nothing 1`] = `<styled.div />`;
140125

141126
exports[`<Field /> should render a vertical form field with regular props 1`] = `

src/domain/Forms/VerticalForm/subcomponents/style.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { styleForMargins } from '../../../Spacers/services/margins'
55

66
interface IStyledInputLabelProps {
77
isRequired: boolean
8-
labelSuffix?: string
98
}
109

1110
interface IFieldWrapperProps {
@@ -53,16 +52,6 @@ const StyledInputLabel = styled.label`
5352
}
5453
`
5554
}}
56-
57-
${(props: IStyledInputLabelProps) => props.labelSuffix && css`
58-
&::after {
59-
color: ${Variables.Color.n400};
60-
content: " - ${props.labelSuffix}";
61-
font-size: ${Variables.FontSize.fzSmall}px;
62-
font-style: italic;
63-
}
64-
`
65-
}}
6655
`
6756

6857
const StyledDescription = styled.div`

0 commit comments

Comments
 (0)