Created
August 23, 2023 12:44
-
-
Save paulodutra/95359dc35a60a0c2d9c3ba817c82ba6d to your computer and use it in GitHub Desktop.
Example of component that use the input and checkbox component
This file contains hidden or 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
import React from 'react'; | |
import { Button } from './Button'; | |
import { Input } from './Input'; | |
import { Checkbox } from './Checkbox'; | |
function App() { | |
const [total, setTotal] = React.useState(0) | |
const [data, setData] = React.useState(''); | |
function increment() { | |
setTotal((total) => total + 1) | |
} | |
return ( | |
<div> | |
<p>Date of schedule: {data}</p> | |
<Input id='name' label='Name' /> | |
<Input id='last-name' label='Last name' /> | |
<Input id='email' label='Email' type='email' /> | |
<Input | |
id='date-schedule' | |
label='Date of schedule' | |
type='date' value={data} | |
onChange={(event) => setData(event.currentTarget.value)} | |
/> | |
<Input id='hour-schedule' label='Hour of schedule' type='time' /> | |
<Checkbox label='Accept terms and conditions'/> | |
<p>{total}</p> | |
<Button | |
id='main-button' | |
className='btn' | |
onClick={increment} | |
lenghtButton="1.25rem" | |
> | |
Increase | |
</Button> | |
</div> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment