File tree Expand file tree Collapse file tree 6 files changed +93
-5
lines changed
Expand file tree Collapse file tree 6 files changed +93
-5
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const Button = ({
77 size = "medium" ,
88 onClick = ( ) => { } ,
99 disabled = false ,
10- label = "Clicked " ,
10+ label = "" ,
1111 ...otherProps
1212} ) => {
1313 const handleClick = ( ) => {
Original file line number Diff line number Diff line change 1+ import classnames from "classnames" ;
2+
3+ const Textarea = ( {
4+ placeholder = "" ,
5+ className = "" ,
6+ rows = 3 ,
7+ label = "" ,
8+ disabled = false ,
9+ ...otherProps
10+ } ) => {
11+ return (
12+ < div className = { classnames ( [ "textarea__wrapper" , className ] ) } >
13+ { label && < label className = "textarea-label" > { label } </ label > }
14+ < div
15+ className = { classnames ( "textarea-input" , {
16+ "textarea-disabled" : disabled ,
17+ } ) }
18+ >
19+ < textarea
20+ placeholder = { placeholder }
21+ rows = { rows }
22+ disabled = { disabled }
23+ { ...otherProps }
24+ />
25+ </ div >
26+ </ div >
27+ ) ;
28+ } ;
29+
30+ export default Textarea ;
Original file line number Diff line number Diff line change 11import Head from "next/head" ;
22import Footer from "../components/Footer" ;
33import Button from "../components/Button" ;
4+ import Textarea from "../components/Textarea" ;
45
56export default function Home ( ) {
67 return (
7- < div className = "h-screen flex-col justify-between bg-black" >
8+ < div className = "h-screen flex-col justify-between bg-black p-5 " >
89 < Head >
910 < title > JSON Style</ title >
1011 < meta name = "description" content = "Generated by create next app" />
1112 < link rel = "icon" href = "/favicon.ico" />
1213 </ Head >
1314
1415 < main >
15- < p className = "text-2xl" > Hello World!</ p >
16- < Button className = "ml-1" label = "Click Me" />
16+ < p className = "text-2xl text-center" > JSON STYLE</ p >
17+ < div className = "space-y-5" >
18+ < Textarea
19+ className = "w-1/2"
20+ rows = { 10 }
21+ label = "JSON String"
22+ onChange = { ( e ) => console . log ( e . target . value ) }
23+ />
24+ < Button className = "ml-1" label = "Click Me" />
25+ </ div >
1726 </ main >
1827 < Footer />
1928 </ div >
Original file line number Diff line number Diff line change 77
88// components
99@import " ./components/button" ;
10+ @import " ./components/textarea" ;
Original file line number Diff line number Diff line change 11body {
2- color : #ffffff ;
2+ color : #e4e4e7 ;
33}
Original file line number Diff line number Diff line change 1+ .textarea__wrapper {
2+ display : flex ;
3+ flex-direction : column ;
4+ justify-content : flex-start ;
5+ align-items : flex-start ;
6+ flex-grow : 1 ;
7+
8+ .textarea-label {
9+ margin-bottom : 4px ;
10+ }
11+
12+ .textarea-input {
13+ width : 100% ;
14+ display : flex ;
15+ flex-direction : row ;
16+ justify-content : flex-start ;
17+ align-items : center ;
18+ font-size : 16px ;
19+ color : #cbd5e1 ;
20+ background-color : #27272a ;
21+
22+ textarea {
23+ width : 100% ;
24+ color : inherit ;
25+ border : none ;
26+ font-size : inherit ;
27+ box-shadow : none ;
28+ outline : none ;
29+ padding : 10px ;
30+ max-height : 224px ;
31+ overflow-y : auto ;
32+ line-height : 1.5 ;
33+ background-color : #27272a ;
34+
35+ & ::placeholder {
36+ color : #e4e4e7 ;
37+ }
38+ }
39+
40+ & .textarea-disabled {
41+ cursor : not-allowed ;
42+ opacity : 0.5 ;
43+ textarea {
44+ cursor : not-allowed ;
45+ }
46+ }
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments