-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.jsx
More file actions
95 lines (85 loc) · 3.23 KB
/
Copy pathApp.jsx
File metadata and controls
95 lines (85 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import React, { useState } from 'react';
import Login from './Login.jsx';
import Sobre from './Sobre.jsx';
import Cursos from './Cursos.jsx';
function App() {
const [paginaAtual, setPaginaAtual] = useState('home');
const [usuarioLogado, setUsuarioLogado] = useState(null);
const fazerLogout = () => setUsuarioLogado(null);
const irPara = (p) => setPaginaAtual(p);
// Renderização Condicional de Telas Inteiras
if (paginaAtual === 'login') {
return (
<Login
voltar={() => irPara('home')}
aoLogarSucesso={(dados) => { setUsuarioLogado(dados); irPara('home'); }}
/>
);
}
if (paginaAtual === 'sobre') {
return <Sobre voltar={() => irPara('home')} />;
}
if (paginaAtual === 'cursos') {
return <Cursos voltar={() => irPara('home')} usuarioLogado={usuarioLogado} />;
}
// Tela Home (Padrão)
return (
<div>
<header className="main-header">
<div className="container header-content">
<div className="logo">CraftCode</div>
<nav>
<ul className="nav-links">
<li><a href="#" onClick={() => irPara('cursos')}>Cursos</a></li>
<li><a href="#" onClick={() => irPara('sobre')}>Sobre</a></li>
<li>
{usuarioLogado ? (
<div style={{ display: 'flex', alignItems: 'center', gap: '15px' }}>
<span style={{ color: 'var(--primary-color)', fontWeight: 'bold' }}>Olá, {usuarioLogado.nome}!</span>
<button onClick={fazerLogout} className="btn-entrar-header" style={{ borderColor: '#FF8C00', color: '#FF8C00' }}>Sair</button>
</div>
) : (
<button onClick={() => irPara('login')} className="btn-entrar-header">Entrar</button>
)}
</li>
</ul>
</nav>
</div>
</header>
<section className="hero">
<div className="container">
<h1>Domine a arte do código</h1>
<p>Aprenda programação com projetos práticos e evolua sua carreira tech.</p>
<button
onClick={() => usuarioLogado ? irPara('cursos') : irPara('login')}
className="btn-primary"
style={{ border: 'none', cursor: 'pointer' }}
>
{usuarioLogado ? 'Ver Meus Cursos' : 'Começar Agora'}
</button>
</div>
</section>
<section className="courses-section">
<div className="container">
<h2>Destaques</h2>
<div className="course-grid">
<article className="course-card">
<div className="card-image"></div>
<div className="card-content">
<h3>Lógica de Programação</h3>
<p>Fundamentos essenciais para iniciantes.</p>
<a href="#" onClick={(e) => { e.preventDefault(); irPara('cursos'); }} className="link-details">Saber mais →</a>
</div>
</article>
</div>
</div>
</section>
<footer>
<div className="container">
<p>© 2026 CraftCode. Todos os direitos reservados.</p>
</div>
</footer>
</div>
);
}
export default App;