@@ -20,6 +20,19 @@ function AddCard({ onCreate, onDeleteAll }) {
2020
2121 const defColor = colors [ 0 ]
2222 const [ color , setColor ] = React . useState ( defColor )
23+ const blackOnHover = ( ) => {
24+ switch ( color ) {
25+ case colors [ 0 ] :
26+ case colors [ 2 ] :
27+ case colors [ 3 ] :
28+ case colors [ 4 ] :
29+ case colors [ 6 ] :
30+ case colors [ 8 ] :
31+ return true
32+ default :
33+ return false
34+ }
35+ }
2336
2437 function submitHandler ( ) {
2538 if ( String ( input . value ( ) ) . trim ( ) && String ( color ) . trim ( ) ) {
@@ -33,7 +46,7 @@ function AddCard({ onCreate, onDeleteAll }) {
3346 < div className = "container" >
3447 < div className = "row my-2 text-center" >
3548
36- < div className = "col-lg-12 col-md-12 p-1" >
49+ < div className = "col-lg-9 col-md-10 col -12 p-1" >
3750 < TextareaAutosize type = "text" className = "form-control" placeholder = "Card name" id = "Text"
3851 { ...input . bind }
3952 style = { { resize : "none" } }
@@ -43,16 +56,15 @@ function AddCard({ onCreate, onDeleteAll }) {
4356 />
4457 </ div >
4558
46- < div className = "col-lg-8 col-md-6 col-sm-4 p-1" >
47- < Palette setColor = { setColor } className = "btn btn-outline-secondary" style = { { width : "100%" } } > </ Palette >
48- </ div >
49-
50- < div className = "col-lg-2 col-md-3 col-sm-4 col-6 p-1" >
51- < button disabled = { ! input . value ( ) . trim ( ) } className = "btn btn-success btn-block" onClick = { submitHandler } > < i className = "bi bi-clipboard-plus" > </ i > Add card</ button >
59+ < div className = "col-lg-1 col-md-1 col-sm-3 col-4 p-1" >
60+ < Palette setColor = { setColor } className = { `btn btn-outline-secondary palitra-btn ${ blackOnHover ( ) ? "palitra-blackOnHover" : "" } ` } style = { { width : "100%" , background : color } } > </ Palette >
5261 </ div >
5362
54- < div className = "col-lg-2 col-md-3 col-sm-4 col-6 p-1" >
55- < button className = "btn btn-danger btn-block" onClick = { onDeleteAll } > < i className = "bi bi-x-square" > </ i > Delete All</ button >
63+ < div className = "col-lg-2 col-md-1 col p-1" >
64+ < button disabled = { ! input . value ( ) . trim ( ) } className = "btn btn-success btn-block" onClick = { submitHandler } >
65+ < i className = "bi bi-clipboard-plus" > </ i >
66+ < span className = 'd-lg-inline d-none' > Add card</ span >
67+ </ button >
5668 </ div >
5769
5870 </ div >
0 commit comments