Skip to content

Commit a0cf5a1

Browse files
authored
Merge pull request #24 from maemreyo/feat/imprv-ui
remove duplicated codes
2 parents d79b2c0 + 677ff32 commit a0cf5a1

File tree

11 files changed

+31
-71
lines changed

11 files changed

+31
-71
lines changed

src/features/inputs/components/CheckboxInput.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
import { useFormContext, useController } from 'react-hook-form';
55
import { CommonInputProps } from '../types';
66
import { FormValues } from '../../dynamic-form';
7-
import { Label, InputWrapper, ErrorMessage } from '../../../styles';
7+
import { Label, ErrorMessage } from '../../../styles';
88
import styled from 'styled-components';
99

1010
const CheckboxInputStyled = styled.input<{ className?: string }>`
@@ -72,11 +72,7 @@ const CheckboxInput: React.FC<CommonInputProps> = ({
7272
defaultValue: fieldConfig.defaultValue,
7373
});
7474
return (
75-
<InputWrapper
76-
$horizontalLabel={horizontalLabel}
77-
$labelWidth={labelWidth}
78-
className={formClassNameConfig.inputWrapper}
79-
>
75+
<>
8076
{label && (
8177
<Label
8278
htmlFor={id}
@@ -99,7 +95,7 @@ const CheckboxInput: React.FC<CommonInputProps> = ({
9995
{error.message}
10096
</ErrorMessage>
10197
)}
102-
</InputWrapper>
98+
</>
10399
);
104100
};
105101

src/features/inputs/components/ComboBox.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
FieldError,
88
} from '../../dynamic-form';
99
import { useFormContext, useController } from 'react-hook-form';
10-
import { Input, Label, ErrorMessage, InputWrapper } from '../../../styles';
10+
import { Input, Label, ErrorMessage } from '../../../styles';
1111
import styled from 'styled-components';
1212

1313
const ComboBoxContainer = styled.div<{ className?: string }>`
@@ -154,11 +154,7 @@ const ComboBox: React.FC<ComboBoxProps> = ({
154154
}
155155
}, [isOpen, highlightedIndex]);
156156
return (
157-
<InputWrapper
158-
$horizontalLabel={horizontalLabel}
159-
$labelWidth={labelWidth}
160-
className={formClassNameConfig.inputWrapper}
161-
>
157+
<>
162158
{label && (
163159
<Label
164160
htmlFor={id}
@@ -215,7 +211,7 @@ const ComboBox: React.FC<ComboBoxProps> = ({
215211
{error.message}
216212
</ErrorMessage>
217213
)}
218-
</InputWrapper>
214+
</>
219215
);
220216
};
221217

src/features/inputs/components/DateInput.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
import { useFormContext, useController } from 'react-hook-form';
55
import { CommonInputProps } from '../types';
66
import { FormValues } from '../../dynamic-form';
7-
import { Input, Label, ErrorMessage, InputWrapper } from '../../../styles';
7+
import { Input, Label, ErrorMessage } from '../../../styles';
88
import { useTheme } from '../../../theme/ThemeProvider';
99

1010
const DateInput: React.FC<CommonInputProps> = ({
@@ -26,11 +26,7 @@ const DateInput: React.FC<CommonInputProps> = ({
2626
defaultValue: fieldConfig.defaultValue,
2727
});
2828
return (
29-
<InputWrapper
30-
$horizontalLabel={horizontalLabel}
31-
$labelWidth={labelWidth}
32-
className={formClassNameConfig.inputWrapper}
33-
>
29+
<>
3430
{label && (
3531
<Label
3632
htmlFor={id}
@@ -55,7 +51,7 @@ const DateInput: React.FC<CommonInputProps> = ({
5551
{error.message}
5652
</ErrorMessage>
5753
)}
58-
</InputWrapper>
54+
</>
5955
);
6056
};
6157

src/features/inputs/components/DateTimePicker.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
import { useFormContext, useController } from 'react-hook-form';
55
import { CommonInputProps } from '../types';
66
import { FormValues } from '../../dynamic-form';
7-
import { Input, Label, ErrorMessage, InputWrapper } from '../../../styles';
7+
import { Input, Label, ErrorMessage } from '../../../styles';
88
import { useTheme } from '../../../theme/ThemeProvider';
99

1010
const DateTimePicker: React.FC<CommonInputProps> = ({
@@ -26,11 +26,7 @@ const DateTimePicker: React.FC<CommonInputProps> = ({
2626
defaultValue: fieldConfig.defaultValue,
2727
});
2828
return (
29-
<InputWrapper
30-
$horizontalLabel={horizontalLabel}
31-
$labelWidth={labelWidth}
32-
className={formClassNameConfig.inputWrapper}
33-
>
29+
<>
3430
{label && (
3531
<Label
3632
htmlFor={id}
@@ -55,7 +51,7 @@ const DateTimePicker: React.FC<CommonInputProps> = ({
5551
{error.message}
5652
</ErrorMessage>
5753
)}
58-
</InputWrapper>
54+
</>
5955
);
6056
};
6157

src/features/inputs/components/NumberInput.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { useState, useEffect, useCallback } from 'react';
44
import { FormValues } from '../../dynamic-form';
55
import { useFormContext, useController } from 'react-hook-form';
66
import { CommonInputProps } from '../types';
7-
import { Input, Label, InputWrapper, ErrorMessage } from '../../../styles';
7+
import { Input, Label, ErrorMessage } from '../../../styles';
88
import styled from 'styled-components';
99
import { useTheme } from '../../../theme/ThemeProvider';
1010

@@ -99,11 +99,7 @@ const NumberInput: React.FC<NumberInputProps> = ({
9999
field.onChange(newValue);
100100
};
101101
return (
102-
<InputWrapper
103-
$horizontalLabel={horizontalLabel}
104-
$labelWidth={labelWidth}
105-
className={formClassNameConfig.inputWrapper}
106-
>
102+
<>
107103
{label && (
108104
<Label
109105
htmlFor={id}
@@ -168,7 +164,7 @@ const NumberInput: React.FC<NumberInputProps> = ({
168164
{error.message}
169165
</ErrorMessage>
170166
)}
171-
</InputWrapper>
167+
</>
172168
);
173169
};
174170

src/features/inputs/components/RadioInput.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
import { FormValues } from '../../dynamic-form';
55
import { useFormContext, useController } from 'react-hook-form';
66
import { CommonInputProps } from '../types';
7-
import { Label, InputWrapper, ErrorMessage } from '../../../styles';
7+
import { Label, ErrorMessage } from '../../../styles';
88
import styled from 'styled-components';
99
import { useTheme } from '../../../theme/ThemeProvider';
1010

@@ -87,11 +87,7 @@ const RadioInput: React.FC<RadioInputProps> = ({
8787
defaultValue: fieldConfig.defaultValue,
8888
});
8989
return (
90-
<InputWrapper
91-
$horizontalLabel={horizontalLabel}
92-
$labelWidth={labelWidth}
93-
className={formClassNameConfig.inputWrapper}
94-
>
90+
<>
9591
{label && (
9692
<Label
9793
$horizontalLabel={horizontalLabel}
@@ -129,7 +125,7 @@ const RadioInput: React.FC<RadioInputProps> = ({
129125
{error.message}
130126
</ErrorMessage>
131127
)}
132-
</InputWrapper>
128+
</>
133129
);
134130
};
135131

src/features/inputs/components/SelectInput.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
import { FormValues } from '../../dynamic-form';
55
import { useFormContext, useController } from 'react-hook-form';
66
import { CommonInputProps } from '../types';
7-
import { Label, ErrorMessage, InputWrapper } from '../../../styles';
7+
import { Label, ErrorMessage } from '../../../styles';
88
import styled from 'styled-components';
99
import { useTheme } from '../../../theme/ThemeProvider';
1010

@@ -74,11 +74,7 @@ const SelectInput: React.FC<SelectInputProps> = ({
7474
defaultValue: fieldConfig.defaultValue,
7575
});
7676
return (
77-
<InputWrapper
78-
$horizontalLabel={horizontalLabel}
79-
$labelWidth={labelWidth}
80-
className={formClassNameConfig.inputWrapper}
81-
>
77+
<>
8278
{label && (
8379
<Label
8480
htmlFor={id}
@@ -104,7 +100,7 @@ const SelectInput: React.FC<SelectInputProps> = ({
104100
{error.message}
105101
</ErrorMessage>
106102
)}
107-
</InputWrapper>
103+
</>
108104
);
109105
};
110106

src/features/inputs/components/SwitchInput.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import { FormValues } from '../../dynamic-form';
44
import { useFormContext, useController } from 'react-hook-form';
55
import { CommonInputProps } from '../types';
6-
import { Label, ErrorMessage, InputWrapper } from '../../../styles';
6+
import { Label, ErrorMessage } from '../../../styles';
77
import styled from 'styled-components';
88

99
const SwitchContainer = styled.label<{ className?: string }>`
@@ -79,11 +79,7 @@ const SwitchInput: React.FC<SwitchInputProps> = ({
7979
defaultValue: fieldConfig.defaultValue,
8080
});
8181
return (
82-
<InputWrapper
83-
$horizontalLabel={horizontalLabel}
84-
$labelWidth={labelWidth}
85-
className={formClassNameConfig.inputWrapper}
86-
>
82+
<>
8783
{label && (
8884
<Label
8985
$horizontalLabel={horizontalLabel}
@@ -110,7 +106,7 @@ const SwitchInput: React.FC<SwitchInputProps> = ({
110106
{error.message}
111107
</ErrorMessage>
112108
)}
113-
</InputWrapper>
109+
</>
114110
);
115111
};
116112

src/features/inputs/components/TextInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useFormContext, useController } from 'react-hook-form';
44
import { CommonInputProps } from '../types';
55
import { FormValues } from '../../dynamic-form';
66
import { useTheme } from '../../../theme/ThemeProvider';
7-
import { Input, Label, InputWrapper } from '../../../styles';
7+
import { Input, Label } from '../../../styles';
88

99
const TextInput: React.FC<CommonInputProps> = ({
1010
id,

src/features/inputs/components/TextareaInput.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import { FormValues } from '../../dynamic-form';
44
import { useFormContext, useController } from 'react-hook-form';
55
import { CommonInputProps } from '../types';
6-
import { Label, ErrorMessage, InputWrapper } from '../../../styles';
6+
import { Label, ErrorMessage } from '../../../styles';
77
import styled from 'styled-components';
88
import { useTheme } from '../../../theme/ThemeProvider';
99

@@ -72,11 +72,7 @@ const TextareaInput: React.FC<TextareaInputProps> = ({
7272
defaultValue: fieldConfig.defaultValue,
7373
});
7474
return (
75-
<InputWrapper
76-
$horizontalLabel={horizontalLabel}
77-
$labelWidth={labelWidth}
78-
className={formClassNameConfig.inputWrapper}
79-
>
75+
<>
8076
{label && (
8177
<Label
8278
htmlFor={id}
@@ -101,7 +97,7 @@ const TextareaInput: React.FC<TextareaInputProps> = ({
10197
{error.message}
10298
</ErrorMessage>
10399
)}
104-
</InputWrapper>
100+
</>
105101
);
106102
};
107103

0 commit comments

Comments
 (0)