mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 02:10:18 +01:00
added buttons to drawer UI
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import useGame from "@/hook/useGame";
|
import useGame from "@/hook/useGame";
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import Button from "../util/button";
|
import Button, { GreenButton, RedButton } from "../util/button";
|
||||||
import TextInput from "../util/textInput";
|
import TextInput from "../util/textInput";
|
||||||
|
|
||||||
export default function ActionDrawer() {
|
export default function ActionDrawer() {
|
||||||
@@ -8,31 +8,40 @@ export default function ActionDrawer() {
|
|||||||
const { sendCurrentPosition } = useGame();
|
const { sendCurrentPosition } = useGame();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={"absolute w-screen bottom-0 z-10 bg-gray-100 flex justify-center rounded-t-2xl transition-all duration-200 flex flex-col " + (visible ? "h-5/6" : "h-20")}>
|
<div className={"absolute w-screen bottom-0 z-10 bg-gray-100 flex justify-center rounded-t-2xl transition-all duration-200 flex flex-col " + (visible ? "h-full" : "h-20")}>
|
||||||
<img src="/icons/arrow_up.png" className={"w-full object-scale-down h-ful max-h-20 transition-all cursor-pointer duration-200 " + (visible && "rotate-180")} onClick={() => setVisible(!visible)} />
|
<img src="/icons/arrow_up.png" className={"w-full object-scale-down h-ful max-h-20 transition-all cursor-pointer duration-200 " + (visible && "rotate-180")} onClick={() => setVisible(!visible)} />
|
||||||
{visible && <div className="flex flex-col w-full h-full">
|
{visible && <div className="flex flex-col w-full h-full">
|
||||||
<div className="h-20 my-2">
|
<div className='shadow-lg mt-0 p-1 flex flex-col text-center mb-1 mt-auto mx-auto w-4/5 rounded'>
|
||||||
<Button onClick={sendCurrentPosition} className="h-10">Update position</Button>
|
<div className='text-gray-700'>
|
||||||
</div>
|
<span className='text-lg text-black'>30min</span>
|
||||||
<div className="my-2">
|
<span> before penalty</span>
|
||||||
<div className="h-20">
|
|
||||||
<TextInput placeholder="Enemy code" onClick={(i) => { console.log(i) }} />
|
|
||||||
</div>
|
</div>
|
||||||
<div className="h-20">
|
|
||||||
<Button onClick={sendCurrentPosition}>Capture target</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className='shadow-lg m-5 p-2 flex flex-col text-center mx-auto w-4/5 rounded'>
|
|
||||||
<p className='text-xl text-black'>30min</p>
|
|
||||||
<p className='text-gray-700'> before penalty</p>
|
|
||||||
<div className='w-1/2 flex flex-row justify-center mx-auto'>
|
<div className='w-1/2 flex flex-row justify-center mx-auto'>
|
||||||
<div className='min-h-5 m-2 min-w-5 bg-green-400'></div>
|
<div className='min-h-5 m-2 min-w-5 bg-green-400'></div>
|
||||||
<div className='min-h-5 m-2 min-w-5 bg-green-400'></div>
|
<div className='min-h-5 m-2 min-w-5 bg-green-400'></div>
|
||||||
<div className='min-h-5 m-2 min-w-5 bg-green-400'></div>
|
<div className='min-h-5 m-2 min-w-5 bg-green-400'></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-20 mb-0 mt-auto">
|
<div className="h-20 my-1">
|
||||||
<Button onClick={sendCurrentPosition}>Log out</Button>
|
<Button onClick={sendCurrentPosition} className="h-10">Update position</Button>
|
||||||
|
</div>
|
||||||
|
<div className="h-20 my-1">
|
||||||
|
<Button onClick={sendCurrentPosition} className="h-10">Message log</Button>
|
||||||
|
</div>
|
||||||
|
<div className="h-20 my-1">
|
||||||
|
<GreenButton onClick={sendCurrentPosition}>See target info</GreenButton>
|
||||||
|
</div>
|
||||||
|
<div className="mt-1 mb-auto">
|
||||||
|
<div className="h-20 flex flex-row">
|
||||||
|
<TextInput placeholder="Enemy code" onClick={(i) => { console.log(i) }} />
|
||||||
|
<GreenButton onClick={sendCurrentPosition}>Capture target</GreenButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="h-20 my-2">
|
||||||
|
<RedButton onClick={sendCurrentPosition}>Signal emergency</RedButton>
|
||||||
|
</div>
|
||||||
|
<div className="h-20 mb-0">
|
||||||
|
<RedButton color={"red"} onClick={sendCurrentPosition}>Log out</RedButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
export default function Button({ children, ...props }) {
|
export default function Button({ children, ...props }) {
|
||||||
return (<button {...props} className={props.className + " bg-blue-600 hover:bg-blue-500 ease-out duration-200 text-white w-full h-full p-4 shadow-sm rounded"}>
|
return (<button {...props} className="bg-blue-600 hover:bg-blue-500 text-lg ease-out duration-200 text-white w-full h-full p-4 shadow-sm rounded">
|
||||||
|
{children}
|
||||||
|
</button>)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RedButton({ children, ...props }) {
|
||||||
|
return (<button {...props} className="bg-red-600 hover:bg-red-500 text-lg ease-out duration-200 text-white w-full h-full p-4 shadow-sm rounded">
|
||||||
|
{children}
|
||||||
|
</button>)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GreenButton({ children, ...props }) {
|
||||||
|
return (<button {...props} className="bg-green-600 hover:bg-green-500 text-lg ease-out duration-200 text-white w-full h-full p-4 shadow-sm rounded">
|
||||||
{children}
|
{children}
|
||||||
</button>)
|
</button>)
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
/** @type {import('tailwindcss').Config} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
mode: 'jit',
|
||||||
content: [
|
content: [
|
||||||
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
|
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
"./components/**/*.{js,ts,jsx,tsx,mdx}",
|
"./components/**/*.{js,ts,jsx,tsx,mdx}",
|
||||||
|
|||||||
Reference in New Issue
Block a user