-
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.
- Loading branch information
Showing
8 changed files
with
99 additions
and
14 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 @@ | ||
1715047079952 1715047083047 |
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,10 @@ | ||
import IMC from '@/components/imc'; | ||
|
||
export default function IMCPage() { | ||
return ( | ||
<main> | ||
<h1>IMC</h1> | ||
<IMC /> | ||
</main> | ||
); | ||
} |
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,7 +1,10 @@ | ||
export default function Home() { | ||
import Acesso from '@/components/acesso'; | ||
|
||
export default function HomePage() { | ||
return ( | ||
<main> | ||
<h1>Home</h1> | ||
<Acesso /> | ||
</main> | ||
); | ||
} |
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,10 +1,11 @@ | ||
import dynamic from 'next/dynamic'; | ||
const Width = dynamic(() => import('@/components/width'), { ssr: false }); | ||
|
||
export default function SobrePage() { | ||
return ( | ||
<main> | ||
<h2>Sobre</h2> | ||
<h2 style={{ margin: '1600px 0' }} id="empresa"> | ||
A Empresa | ||
</h2> | ||
<h1>Sobre</h1> | ||
<Width /> | ||
</main> | ||
); | ||
} |
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,7 @@ | ||
import fs from 'fs/promises'; | ||
|
||
export default async function Acesso() { | ||
await fs.appendFile('acesso.txt', `${Date.now()} `, 'utf8'); | ||
const data = await fs.readFile('acesso.txt', 'utf8'); | ||
return <div>{data}</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,38 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
export default function IMC() { | ||
const [peso, setPeso] = React.useState(''); | ||
const [altura, setAltura] = React.useState(''); | ||
const [imc, setImc] = React.useState(''); | ||
|
||
function handleClick() { | ||
const alturaMetro = Number(altura) / 100; | ||
const total = (Number(peso) / (alturaMetro * alturaMetro)).toFixed(2); | ||
setImc(total); | ||
} | ||
|
||
return ( | ||
<div> | ||
<label htmlFor="peso">Peso (em kg)</label> | ||
<input | ||
type="number" | ||
id="peso" | ||
name="peso" | ||
value={peso} | ||
onChange={(e) => setPeso(e.target.value)} | ||
/> | ||
<label htmlFor="altura">Altura (em cm)</label> | ||
<input | ||
type="number" | ||
id="altura" | ||
name="altura" | ||
value={altura} | ||
onChange={(e) => setAltura(e.target.value)} | ||
/> | ||
<button onClick={handleClick}>Calcular</button> | ||
<p>IMC: {imc}</p> | ||
</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
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,31 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
export default function Width() { | ||
const [width, setWidth] = React.useState( | ||
document.documentElement.clientWidth, | ||
); | ||
|
||
React.useEffect(() => { | ||
const handleResize = () => { | ||
setWidth(document.documentElement.clientWidth); | ||
}; | ||
handleResize(); | ||
window.addEventListener('resize', handleResize); | ||
return () => { | ||
window.removeEventListener('resize', handleResize); | ||
}; | ||
}, []); | ||
|
||
const [ativo, setAtivo] = React.useState(false); | ||
|
||
return ( | ||
<div> | ||
<h2 style={{ color: ativo ? '#680' : '#b00' }}> | ||
Largura da tela: {width} | ||
</h2> | ||
<button onClick={() => setAtivo((b) => !b)}>Ativar</button> | ||
</div> | ||
); | ||
} |