@@ -33,6 +33,7 @@ export default function Home() {
3333 const [ copied , setCopied ] = useState ( false ) ;
3434 const [ loading , setLoading ] = useState ( false ) ;
3535 const [ error , setError ] = useState ( initError ) ;
36+ const [ oneline , setOneline ] = useState ( false ) ;
3637
3738 const [ inputKey , setInputKey ] = useState ( "" ) ;
3839 const [ outputKey , setOutputKey ] = useState ( null ) ;
@@ -112,27 +113,52 @@ export default function Home() {
112113 < >
113114 < Success />
114115
115- < div className = "max-w-4xl mx-auto" >
116+ < div className = "max-w-3xl mx-auto" >
116117 < pre className = "px-4 py-3 mt-8 font-mono text-left bg-transparent border rounded border-zinc-600 focus:border-zinc-100/80 focus:ring-0 sm:text-sm text-zinc-100" >
117118 < div className = "flex items-start px-1 pt-6 relative text-sm" >
118- < label htmlFor = "inputKey" className = "absolute top-0 text-xs font-medium text-zinc-100" >
119- { keyTypes [ outputFormat ] . title }
120- </ label >
119+ < div className = "absolute top-0 w-full flex items-center justify-between" >
120+ < label htmlFor = "outputKey" className = "text-xs font-medium text-zinc-100" >
121+ { keyTypes [ outputFormat ] . title }
122+ </ label >
123+ < span className = "flex items-center space-x-2" >
124+ < label for = "oneline" htmlFor = "oneline" className = "text-xs uppercase font-medium text-zinc-100" >
125+ Oneline
126+ </ label >
127+ < input
128+ type = "checkbox"
129+ id = "oneline"
130+ name = "oneline"
131+ className = "rounded-sm"
132+ checked = { oneline }
133+ onChange = { ( e ) => setOneline ( prevState => ! prevState ) }
134+ />
135+ </ span >
136+ </ div >
121137 < div aria-hidden = "true" className = "pr-4 font-mono border-r select-none border-zinc-300/5 text-zinc-700" >
122138 { Array . from ( {
123- length : outputKey . split ( "\n" ) . length ,
139+ length : oneline ? 1 : outputKey . split ( "\n" ) . length ,
124140 } ) . map ( ( _ , index ) => (
125141 < Fragment key = { index } >
126142 { ( index + 1 ) . toString ( ) . padStart ( 2 , "0" ) }
127143 < br />
128144 </ Fragment >
129145 ) ) }
130146 </ div >
131- < div >
132- < pre className = "flex overflow-x-auto" >
133- < code className = "px-4 text-left" > { outputKey } </ code >
134- </ pre >
135- </ div >
147+ { oneline ? (
148+ < input
149+ type = "text"
150+ readOnly
151+ className = "w-full pl-4 p-0 text-base bg-transparent border-0 appearance-none resize-none hover:resize text-zinc-100 placeholder-zinc-500 focus:ring-0 sm:text-sm"
152+ value = { outputKey ?. replace ( / \n / g, "\\n" ) }
153+ />
154+ ) : (
155+ < textarea
156+ readOnly
157+ className = "w-full pl-4 p-0 text-base bg-transparent border-0 appearance-none resize-none hover:resize text-zinc-100 placeholder-zinc-500 focus:ring-0 sm:text-sm"
158+ value = { outputKey }
159+ rows = { Math . max ( 5 , outputKey ?. split ( "\n" ) . length ) }
160+ />
161+ ) }
136162 </ div >
137163 </ pre >
138164
@@ -188,7 +214,6 @@ export default function Home() {
188214 ) ) }
189215 </ div >
190216 < textarea
191- type = "text"
192217 name = "inputKey"
193218 id = "inputKey"
194219 required
0 commit comments