11'use client'
2- import { Box , Flex , Image , Input , Text , VStack } from '@devup-ui/react'
2+ import { Box , Flex , Image , Text , VStack } from '@devup-ui/react'
33import { useEffect , useState } from 'react'
44
5+ import { TransInput } from './TransInput'
6+
57export function Trans ( ) {
68 const [ input , setInput ] = useState ( '' )
79 const [ translateToUnicode , setTranslateToUnicode ] = useState <
@@ -19,6 +21,10 @@ export function Trans() {
1921 } )
2022 } )
2123 } , [ input ] )
24+
25+ const [ inputFocused , setInputFocused ] = useState ( false )
26+ const [ translationFocused , setTranslationFocused ] = useState ( false )
27+
2228 return (
2329 < VStack gap = { [ '16px' , null , null , '30px' ] } >
2430 < Flex
@@ -45,34 +51,25 @@ export function Trans() {
4551 alignItems = "center"
4652 flexDirection = { [ 'column' , null , null , 'row' ] }
4753 gap = { [ '12px' , null , null , '30px' ] }
48- h = { [ 'auto' , null , null , '500px' ] }
54+ h = { [ inputFocused ? '50dvh' : 'auto' , null , null , '500px' ] }
4955 >
50- < Flex flex = "1" h = "100%" w = "100%" >
51- < Input
52- as = "textarea"
53- bg = "$containerBackground"
54- border = "none"
55- borderRadius = { [ '16px' , null , null , '30px' ] }
56- color = "$text"
57- h = { [ '400px' , null , null , 'auto' ] }
58- onChange = { ( e ) => setInput ( e . target . value ) }
59- p = { [ '16px' , null , null , '40px' ] }
60- placeholder = {
61- 'braillify는 한글 점역을 빠르고 안정적으로 처리하는 Rust 기반 라이브러리입니다.\nNode.js, WebAssembly, Python 등 다양한 환경에서 사용할 수 있어요.\n\n점역하고 싶은 문장이나 단어를 여기에 입력해 직접 확인해보세요!'
62- }
63- resize = "none"
64- selectors = { {
65- '&::placeholder' : {
66- color : '$text' ,
67- typography : 'braille' ,
68- opacity : 0.5 ,
69- } ,
70- } }
71- typography = "braille"
72- value = { input }
73- w = "100%"
74- />
75- </ Flex >
56+ < TransInput
57+ blurPlaceholder = {
58+ 'braillify는 한글 점역을 빠르고 안정적으로 처리하는 Rust 기반 라이브러리입니다.\nNode.js, WebAssembly, Python 등 다양한 환경에서 사용할 수 있어요.\n\n점역하고 싶은 문장이나 단어를 여기에 입력해 직접 확인해보세요!'
59+ }
60+ focusPlaceholder = "이곳에 점역할 내용을 입력해주세요!"
61+ isFocused = { inputFocused }
62+ onBlur = { ( ) => {
63+ setInputFocused ( false )
64+ setTranslationFocused ( false )
65+ } }
66+ onChange = { ( e ) => setInput ( e . target . value ) }
67+ onFocus = { ( ) => {
68+ setInputFocused ( true )
69+ setTranslationFocused ( true )
70+ } }
71+ value = { input }
72+ />
7673 < Flex >
7774 < Image
7875 alt = ""
@@ -88,32 +85,15 @@ export function Trans() {
8885 w = { [ '16px' , null , null , '24px' ] }
8986 />
9087 </ Flex >
91- < Flex flex = "1" h = "100%" w = "100%" >
92- < Input
93- as = "textarea"
94- bg = "$containerBackground"
95- border = "none"
96- borderRadius = { [ '16px' , null , null , '30px' ] }
97- color = "$text"
98- h = { [ '400px' , null , null , 'auto' ] }
99- p = { [ '16px' , null , null , '40px' ] }
100- placeholder = {
101- '⠴⠃⠗⠁⠊⠇⠇⠊⠋⠽⠲⠉⠵ ⠚⠒⠈⠮ ⠨⠎⠢⠱⠁⠮ ⠠⠘⠐⠪⠈⠥ ⠣⠒⠨⠻⠨⠹⠪⠐⠥ ⠰⠎⠐⠕⠚⠉⠵ ⠴⠠⠗⠥⠌⠲ ⠈⠕⠘⠒ ⠐⠣⠕⠘⠪⠐⠎⠐⠕⠕⠃⠉⠕⠊⠲\n⠴⠠⠝⠕⠙⠑⠲⠚⠎⠂ ⠠⠺⠑⠃⠠⠁⠎⠎⠑⠍⠃⠇⠽⠂ ⠠⠏⠽⠹⠕⠝⠲ ⠊⠪⠶ ⠊⠣⠜⠶⠚⠒ ⠚⠧⠒⠈⠻⠝⠠⠎ ⠇⠬⠶⠚⠂ ⠠⠍ ⠕⠌⠎⠬⠲\n\n⠨⠎⠢⠱⠁⠚⠈⠥ ⠠⠕⠲⠵ ⠑⠛⠨⠶⠕⠉ ⠊⠒⠎⠐⠮ ⠱⠈⠕⠝ ⠕⠃⠐⠱⠁⠚⠗ ⠨⠕⠁⠨⠎⠃ ⠚⠧⠁⠟⠚⠗⠘⠥⠠⠝⠬⠖'
102- }
103- readOnly
104- resize = "none"
105- selectors = { {
106- '&::placeholder' : {
107- color : '$text' ,
108- typography : 'braille' ,
109- opacity : 0.5 ,
110- } ,
111- } }
112- typography = "braille"
113- value = { translateToUnicode ( input ) }
114- w = "100%"
115- />
116- </ Flex >
88+ < TransInput
89+ blurPlaceholder = {
90+ '⠴⠃⠗⠁⠊⠇⠇⠊⠋⠽⠲⠉⠵ ⠚⠒⠈⠮ ⠨⠎⠢⠱⠁⠮ ⠠⠘⠐⠪⠈⠥ ⠣⠒⠨⠻⠨⠹⠪⠐⠥ ⠰⠎⠐⠕⠚⠉⠵ ⠴⠠⠗⠥⠌⠲ ⠈⠕⠘⠒ ⠐⠣⠕⠘⠪⠐⠎⠐⠕⠕⠃⠉⠕⠊⠲\n⠴⠠⠝⠕⠙⠑⠲⠚⠎⠂ ⠠⠺⠑⠃⠠⠁⠎⠎⠑⠍⠃⠇⠽⠂ ⠠⠏⠽⠹⠕⠝⠲ ⠊⠪⠶ ⠊⠣⠜⠶⠚⠒ ⠚⠧⠒⠈⠻⠝⠠⠎ ⠇⠬⠶⠚⠂ ⠠⠍ ⠕⠌⠎⠬⠲\n\n⠨⠎⠢⠱⠁⠚⠈⠥ ⠠⠕⠲⠵ ⠑⠛⠨⠶⠕⠉ ⠊⠒⠎⠐⠮ ⠱⠈⠕⠝ ⠕⠃⠐⠱⠁⠚⠗ ⠨⠕⠁⠨⠎⠃ ⠚⠧⠁⠟⠚⠗⠘⠥⠠⠝⠬⠖'
91+ }
92+ focusPlaceholder = "⠕⠈⠥⠄⠝⠀⠨⠎⠢⠱⠁⠚⠂⠀⠉⠗⠬⠶⠮⠀⠕⠃⠐⠱⠁⠚⠗⠨⠍⠠⠝⠬⠖"
93+ isFocused = { translationFocused }
94+ readOnly
95+ value = { translateToUnicode ( input ) }
96+ />
11797 </ Flex >
11898 </ VStack >
11999 )
0 commit comments