1
0
mirror of https://github.com/mizanxali/uno-online synced 2024-06-26 09:24:23 +00:00
uno-online/client/src/components/Homepage.js

20 lines
675 B
JavaScript
Raw Normal View History

2021-02-22 15:34:17 +00:00
import React, { useState } from 'react'
import { Link } from 'react-router-dom'
2021-02-22 15:45:04 +00:00
import randomCodeGenerator from '../utils/randomCodeGenerator'
2021-02-11 20:01:04 +00:00
2021-02-17 01:34:27 +00:00
const Homepage = () => {
2021-02-22 15:34:17 +00:00
const [roomCode, setRoomCode] = useState('')
2021-02-11 20:01:04 +00:00
return (
2021-02-12 10:31:40 +00:00
<div className='Homepage'>
<h1>UNO</h1>
2021-02-22 15:45:04 +00:00
<div><input type='text' placeholder='Game Code' onChange={(event) => setRoomCode(event.target.value)} /></div>
<Link to={`/play?roomCode=${roomCode}`}><button>JOIN GAME</button></Link>
<h1>OR</h1>
<Link to={`/play?roomCode=${randomCodeGenerator(5)}`}><button>CREATE GAME</button></Link>
2021-02-11 20:01:04 +00:00
</div>
)
}
2021-02-17 01:34:27 +00:00
export default Homepage