Skip to content

Commit 5f017e4

Browse files
committed
chore: README 수정
1 parent dd5ca5a commit 5f017e4

File tree

1 file changed

+81
-2
lines changed

1 file changed

+81
-2
lines changed

README.md

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ yarn add react-validate-component
2424

2525
## 사용법, How to use
2626

27-
현재 라이브러리에는 `VText` 컴포넌트가 구현되어 있습니다. 이 컴포넌트를 사용하여 텍스트 입력 필드의 유효성 검사를 쉽게 구현할 수 있습니다.
27+
현재 라이브러리에는 `VText`, `VCheckbox`, `VURL` 컴포넌트가 구현되어 있습니다. 이 컴포넌트를 사용하여 텍스트 입력 필드의 유효성 검사를 쉽게 구현할 수 있습니다.
2828

29-
The library currently includes the `VText` component. You can use this component to easily implement validation for text input fields.
29+
The library currently includes the `VText`, `VCheckbox`, `VURL` component. You can use this component to easily implement validation for text input fields.
3030

3131
### VText Component
3232

@@ -201,6 +201,85 @@ export default App;
201201
- `vIsAnimate` (boolean): Whether to apply animation when displaying the validation message (currently, only opacity animation is supported).
202202
- `props` (object): Other options. Enter values for attributes that can be added to the basic input tag.
203203

204+
### VURL Component
205+
206+
`VURL` 컴포넌트는 기본적인 URL 필드에 유효성 검사 문구를 출력해주는 기능을 제공합니다.
207+
208+
The `VURL` component provides functionality to display validation messages for basic url fields.
209+
210+
#### 사용 예제, Example
211+
212+
```jsx
213+
import React from 'react';
214+
import { VText } from 'react-validate-component';
215+
216+
const App = () => {
217+
const [vState, setvState] = React.useState < boolean > false;
218+
const [vMessage, setvMessage] = React.useState < string > '';
219+
const [message, setmessage] =
220+
React.useState < string > 'https://www.naver.com';
221+
222+
React.useEffect(() => {
223+
if (/^http[s]?:\/\/([\S]{3,})/i.test(message)) {
224+
setvState(false);
225+
setvMessage('');
226+
} else {
227+
setvState(true);
228+
setvMessage('IT MUST BE URL.');
229+
}
230+
}, [message]);
231+
232+
return (
233+
<div>
234+
<h2>VURL</h2>
235+
<h3>INPUT URL.</h3>
236+
<VURL
237+
vState={vState}
238+
vType={'outer'}
239+
// vClassName={'test'}
240+
vShowMessage={true}
241+
vMessage={vMessage}
242+
vLocateMessage={'bottom-left'}
243+
vMessageClass={styles.validation_message}
244+
vIsAnimate={true}
245+
props={{
246+
onChange: (e: { target: { value: string } }) => {
247+
setmessage(e.target.value);
248+
},
249+
placeholder: 'this is react-validate-component test.',
250+
className: styles.input_text,
251+
defaultValue: 'https://www.naver.com',
252+
}}
253+
/>
254+
</div>
255+
);
256+
};
257+
258+
export default App;
259+
```
260+
261+
#### Props
262+
263+
- `vState` (boolean): 유효성 상태 값입니다.
264+
- `vType` (`inner`, `outer`, `tooltip`): 유효성 메시지를 띄우는 타입입니다.
265+
- `vClassName` (string): 유효성 입힐 class 명입니다.
266+
- `vShowMessage` (boolean): 유효성 메시지 출력 여부값입니다.
267+
- `vMessage` (string): 유효성 검사 실패 시 표시할 에러 메시지입니다.
268+
- `vLocateMessage` (`top-left`, `top`, `top-right`, `center-left`, `center`, `center-right`, `bottom-left`, `bottom`, `bottom-right`): 유효성 메시지를 element 어디에 붙일지 위치값입니다.
269+
- `vMessageClass` (string): 유효성 메시지에 입힐 class 명입니다.
270+
- `vIsAnimate` (boolean): 유효성 메시지 출력 시 애니메이션 적용할지 여부입니다. (현재는 opacity만 적용되어있습니다.)
271+
- `props` (object): 기타 옵션입니다. 기본 input 태그에 attribute로 넣을 값들을 입력하시면 됩니다.
272+
273+
- `vState` (boolean): The validity status value.
274+
- `vType` (`inner`, `outer`, `tooltip`): The type of validation message display.
275+
- `vClassName` (string): The class name to apply for validation styling.
276+
- `vShowMessage` (boolean): Whether to display the validation message.
277+
- `vMessage` (string): The error message to display when validation fails.
278+
- `vLocateMessage` (`top-left`, `top`, `top-right`, `center-left`, `center`, `center-right`, `bottom-left`, `bottom`, `bottom-right`): The position where the validation message should be displayed relative to the element.
279+
- `vMessageClass` (string): The class name to apply to the validation message.
280+
- `vIsAnimate` (boolean): Whether to apply animation when displaying the validation message (currently, only opacity animation is supported).
281+
- `props` (object): Other options. Enter values for attributes that can be added to the basic input tag.
282+
204283
### 유효성 검사 규칙, Validation Rules
205284

206285
- 지금은 사용자가 정규식 혹은 함수를 이용해 작성한 유효성검사 로직을 토대로 element에 출력하고 있습니다.

0 commit comments

Comments
 (0)