-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
66 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { useState } from 'react'; | ||
import { FaSearch } from 'react-icons/fa'; | ||
import './style.css'; | ||
|
||
function Learn_6() { | ||
const [showInput, setShowInput] = useState(false); | ||
const [bgColor, setBgColor] = useState('white'); | ||
|
||
const handleClick = (e) => { | ||
setBgColor('#1a1a1a'); | ||
if (e.target.className === 'container') { | ||
setShowInput(false); | ||
setBgColor('#fff'); | ||
} | ||
}; | ||
|
||
return ( | ||
<section className="container" style={{ backgroundColor: bgColor }} onClick={handleClick}> | ||
{showInput ? ( | ||
<input type="text" placeholder="Search..." /> | ||
) : ( | ||
<FaSearch onClick={() => setShowInput(true)} /> | ||
)} | ||
</section> | ||
); | ||
} | ||
|
||
export default Learn_6; |
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,33 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
section { | ||
height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
transition: 0.7s ease; | ||
} | ||
|
||
button { | ||
position: absolute; | ||
top: 20px; | ||
right: 20px; | ||
padding: 10px 20px; | ||
background: transparent; | ||
cursor: pointer; | ||
} | ||
|
||
input { | ||
padding: 13px 12px; | ||
background: transparent; | ||
outline: none; | ||
border: 1px solid #fff; | ||
color: #fff; | ||
border-radius: 2px; | ||
box-shadow: 2px 2px 2px 1px rgb(35, 35, 35); | ||
} |
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