-
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
Gabriel0109
committed
Mar 1, 2023
1 parent
4179404
commit d32509a
Showing
11 changed files
with
222 additions
and
18 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import styles from './styles.module.scss' | ||
import { useContext, useState } from 'react' | ||
import { FormContext } from "../../hooks/useForm"; | ||
import { GrClose } from 'react-icons/gr' | ||
|
||
|
||
|
||
export function Form() { | ||
const {activateForm } = useContext(FormContext) | ||
|
||
const [selectedOption, setSelectedOption] = useState(null); | ||
|
||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
console.log(selectedOption); | ||
} | ||
|
||
|
||
return ( | ||
|
||
<> | ||
<div className="fixed bottom-0 translate-x-1/2 right-1/2 w-11/12 z-[402]"> | ||
<div className={styles.formCard}> | ||
<div className="flex justify-end"> | ||
<button onClick={() => activateForm()}> | ||
<GrClose /> | ||
</button> | ||
</div> | ||
<h1 className="text-xl text-center font-semibold mb-3">Essa informação<br/> foi útil para você?</h1> | ||
<form className='flex flex-col' onSubmit={handleSubmit}> | ||
<div className='flex justify-evenly'> | ||
<label className={styles.thumbContainer}> | ||
<input type="radio" value="thumbsUp" checked={selectedOption === "positivo"} onChange={() => setSelectedOption("positivo")} /> | ||
<span className={styles.thumbUp}></span> | ||
</label> | ||
<label className={styles.thumbContainer}> | ||
<input type="radio" value="thumbsDown" checked={selectedOption === "negativo"} onChange={() => setSelectedOption("negativo")} /> | ||
<span className={styles.thumbDown}></span> | ||
</label> | ||
</div> | ||
<div className='mt-5'> | ||
<p className="text-sm text-center font-semibold mb-3">Quer deixar um comentário?</p> | ||
<input className='rounded-md w-full p-2 pb-8 bg-[#cccccc]/25' type="text" name="" id="" placeholder='Digite algo aqui...' /> | ||
|
||
</div> | ||
<button className='block bg-black text-white text-bold uppercase p-1 rounded-md mt-3' type="submit">Enviar</button> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
|
||
</> | ||
) | ||
|
||
|
||
} |
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,75 @@ | ||
.formCard { | ||
background-color: var(--white); | ||
border-top-left-radius: 8px; | ||
border-top-right-radius: 8px; | ||
padding: 20px; | ||
padding-bottom: 5rem; | ||
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); | ||
overflow: scroll; | ||
|
||
|
||
} | ||
|
||
.routeList { | ||
|
||
li:last-child { | ||
border-bottom: none !important; | ||
} | ||
|
||
.routeName { | ||
display: flex; | ||
align-items: center; | ||
|
||
.shortName { | ||
display: flex; | ||
background-color: var(--items-bg); | ||
border-radius: 3px; | ||
padding: 4px 3px; | ||
|
||
p { | ||
color: var(--text-color); | ||
} | ||
} | ||
} | ||
} | ||
|
||
.directionBanner { | ||
background-color: var(--gray-100); | ||
text-align: center; | ||
padding: 8px; | ||
margin-bottom: 25px; | ||
} | ||
.thumbContainer{ | ||
display: block; | ||
position: relative; | ||
margin-block: 20px ; | ||
input{ | ||
display: none; | ||
} | ||
} | ||
.thumbUp:after{ | ||
content: url(../../assets/imgs/thumbs.svg); | ||
position: absolute; | ||
top: -10px; | ||
left: -18px; | ||
padding: 4px; | ||
width: 35px; | ||
display: block; | ||
height: 35px; | ||
border-radius: 50em; | ||
border: 2px solid black; | ||
|
||
} | ||
.thumbDown:after{ | ||
content: url(../../assets/imgs/thumbs.svg); | ||
position: absolute; | ||
top: -10px; | ||
left: -18px; | ||
padding: 4px; | ||
width: 35px; | ||
display: block; | ||
height: 35px; | ||
border-radius: 50em; | ||
border: 2px solid black; | ||
transform: rotate(180deg); | ||
} |
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
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,25 @@ | ||
import { createContext, useEffect, useState } from "react"; | ||
|
||
|
||
export const FormContext = createContext() | ||
|
||
|
||
|
||
|
||
export function FormProvider({ children }) { | ||
const [activeForm, setActiveForm] = useState(false) | ||
|
||
function activateForm() { | ||
if (activeForm) { | ||
setActiveForm(false) | ||
} else { | ||
setActiveForm(true) | ||
} | ||
} | ||
|
||
return ( | ||
<FormContext.Provider value={{activeForm, setActiveForm, activateForm}}> | ||
{children} | ||
</FormContext.Provider> | ||
) | ||
} |
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
Oops, something went wrong.