-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: chosungIncludes 메서드를 문서에서 바로 사용해볼 수 있는 데모를 만듭니다. (#102)
* chosungIncludes페이지 데모 만들기 * remove unnecessary file * Update docs/src/components/demo/chosung-includes-demo.tsx Co-authored-by: Jonghyeon Ko <[email protected]> * Update docs/src/pages/docs/api/chosungIncludes.ko.mdx Co-authored-by: Jonghyeon Ko <[email protected]> * Update docs/src/pages/docs/api/chosungIncludes.en.mdx Co-authored-by: Jonghyeon Ko <[email protected]> * linting * remove useEffect in import statement * chore: remove unnecessary mdx title * light모드 대응하기: * change ^ => * --------- Co-authored-by: Jonghyeon Ko <[email protected]> Co-authored-by: Jonghyeon Ko <[email protected]>
- Loading branch information
1 parent
48ce65f
commit 56fa610
Showing
6 changed files
with
65 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { useState } from 'react'; | ||
import { chosungIncludes } from 'es-hangul'; | ||
|
||
export function ChosungIncludesDemo() { | ||
const [searchWord, setSearchWord] = useState<string>('홍길동'); | ||
const [userInput, setUserInput] = useState<string>('ㅎㄱㄷ'); | ||
|
||
const result = chosungIncludes(searchWord, userInput); | ||
|
||
return ( | ||
<div className="bg-gray-200 dark:bg-gray-800 rounded-lg shadow-md p-6 max-w-md mx-auto my-8"> | ||
<div className="mb-4"> | ||
<label htmlFor="searchWord" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> | ||
Search Word | ||
</label> | ||
<input | ||
id="searchWord" | ||
type="text" | ||
placeholder="Enter search word" | ||
value={searchWord} | ||
onChange={e => setSearchWord(e.target.value)} | ||
className="w-full p-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-300" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="userInput" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"> | ||
User Input | ||
</label> | ||
<input | ||
id="userInput" | ||
type="text" | ||
placeholder="Enter user input" | ||
value={userInput} | ||
onChange={e => setUserInput(e.target.value)} | ||
className="w-full p-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-300" | ||
/> | ||
</div> | ||
{result !== null && ( | ||
<p | ||
className={`mt-4 text-lg ${result ? 'text-green-500 dark:text-green-400' : 'text-red-500 dark:text-red-400'}`} | ||
> | ||
Result: {result ? 'Match found' : 'No match'} | ||
</p> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters