-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from salino3/add-input
Add input
- Loading branch information
Showing
9 changed files
with
117 additions
and
8 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
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
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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./image-rotate"; | ||
export * from "./input-text"; |
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 @@ | ||
export * from "./input-text.component"; |
34 changes: 34 additions & 0 deletions
34
src/pods/home/components/input-text/input-text.component.tsx
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,34 @@ | ||
import React, { useState } from "react"; | ||
import "./input-text.styles.scss"; | ||
|
||
export const CustomInputText: React.FC = () => { | ||
const [inputValue, setInputValue] = useState(""); | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
setInputValue(event.target.value); | ||
}; | ||
|
||
return ( | ||
<div className="rootCustomInputText"> | ||
<div className="containerTitle"> | ||
<h2>Custom Text Input</h2> | ||
</div> | ||
<div className="containerInput"> | ||
<input | ||
type="text" | ||
id="city" | ||
className="inputText" | ||
name="city" | ||
value={inputValue} | ||
onChange={handleChange} | ||
/> | ||
<label | ||
htmlFor="city" | ||
className={`inputLabel ${inputValue ? "shrink" : ""}`} | ||
> | ||
What city do you live? | ||
</label> | ||
</div> | ||
</div> | ||
); | ||
}; |
44 changes: 44 additions & 0 deletions
44
src/pods/home/components/input-text/input-text.styles.scss
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,44 @@ | ||
.rootCustomInputText { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 1rem; | ||
|
||
.containerInput { | ||
position: relative; | ||
width: 50%; | ||
|
||
.inputText { | ||
border-radius: 0.5rem; | ||
padding: 1rem 0.5rem 0.5rem 1rem; | ||
box-shadow: var(--color-two) 0px 0px 16px; | ||
width: 100%; | ||
outline: none; | ||
border: 0.5px solid; | ||
} | ||
|
||
.inputLabel { | ||
position: absolute; | ||
top: 50%; | ||
left: 1rem; | ||
transform: translateY(-50%); | ||
transition: all 0.3s ease; | ||
pointer-events: none; | ||
color: #999; | ||
} | ||
|
||
.inputText:focus + .inputLabel, | ||
.shrink { | ||
top: 0; | ||
left: 1rem; | ||
font-size: 0.8rem; | ||
transform: translateY(-110%); | ||
color: black; | ||
} | ||
|
||
.inputText:focus { | ||
box-shadow: #ffec1f 0px 0px 16px; | ||
} | ||
} | ||
} |
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
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