-
Notifications
You must be signed in to change notification settings - Fork 1
/
]
114 lines (102 loc) · 3.37 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import data from '../public/data.json';
import 'tailwindcss/tailwind.css'
import { useState } from 'react';
//@TODO: Fazer um menu com:
// About
// Instruções
// Jogos passados
function NavCard(props) {
var style;
if (props.current == true) {
style = 'text-gray-300 bg-gray-900 px-3 py-2 rounded-md text-sm font-medium" aria-current="page"';
} else {
style = 'text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium';
}
return (
<a href={props.href} className={style}>{props.name}</a>
)
}
export function NavBar(props) {
return (
<div className="">
<div className="flex space-x-4">
{
props.cards.map((card, idx) => (
<NavCard name={card[0]} href={card[1]} current={card[0] == props.current} />
))
}
</div>
</div>
)
}
NavBar.defaultProps = {
cards: [['Jogos', '/'], ['Sobre', '/about'], ['Instruções', '/instructions']],
}
function GameCard(props) {
var web;
if (JSON.parse(props.game.web) == true) {
web =
<div className="text-base text-gray-50 bg-indigo-600 rounded-xl uppercase font-bold">
<div className="m-1">
web
</div>
</div>;
} else {
web = <div></div>
}
return (
<div className=" rounded-x1 shadow-md max-w-md mx-auto rounded-3xl shadow-md overflow-hidden bg-gray-50">
<div className="p-8">
<div className="flex space-x-20">
<div className="text-base text-indigo-600 font-semibold tracking-wide uppercase">
{props.game.class}
</div>
{web}
</div>
<a href={props.game.link} className="block mt-1 text-lg leading-tight font-semibold text-black hover:underline">
{props.game.name}
</a>
<div className="mt-2 text-gray-500">
Autores: {props.game.team}
</div>
<Expand>Oi seu curioso saphado</Expand>
</div>
</div>
)
}
function Footer(propos) {
return (
<div className="text-white bg-gray-800">
Hellow world
</div>
)
}
function Expand(props) {
const [isVisible, setisVisible] = useState(false);
let children = props.children.substr(0, 5) + "...";
return (
<div className="">
<div className="flex">
<div className={`${ !isVisible ? "" : "hidden" }`}> {children} </div>
<div className={`${ isVisible ? "" : "" } cursor-pointer hover:underline`} onClick={() => setisVisible(!isVisible)}> {isVisible ? "(Ler menos)" : "(Ler mais)"} </div>
</div>
<div className={`${ isVisible ? "" : "hidden" }`}> {props.children} </div>
</div>
)
}
function Home() {
return (
<div className="space-y-5 bg-gray-800 min-h-screen">
<NavBar current='Jogos' />
<div>_</div>
<div className="text-center mt-8 mb-8 text-3xl leading-8 font-extrabold tracking-tight text-yellow-400">Jogos</div>
{
data.games.map((game) => (
<GameCard game={game} />
))
}
<Footer/>
</div >
)
}
export default Home;