Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve modal solve for mobile size #158

Merged
merged 2 commits into from
Nov 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/components/solves/ModalSolve.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import formatTime from "@/lib/formatTime";
import moveSolve from "@/lib/moveSolve";
import { ScrambleDisplay } from "../scramble-display";
import { cubeCollection } from "@/lib/cubeCollection";
import CalendarDays from "@/icons/CalentarDays";

export default function ModalSolve() {
const { status, solve, setStatus } = useSolvesStore();
Expand Down Expand Up @@ -66,23 +67,34 @@ export default function ModalSolve() {
return (
<>
<div
className="fixed backdrop-blur-[2px] top-0 left-0 z-50 w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-screen flex flex-col items-center text-neutral-950"
className="fixed backdrop-blur-[2px] top-0 left-0 z-50 w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-screen flex flex-col items-center text-neutral-950 justify-center"
onClick={(e) => {
if (e.target === e.currentTarget) setStatus(false);
}}
>
<div className="w-full h-auto text-xs border rounded-md sm:w-96 bg-neutral-200 border-neutral-800 ">
<div className="flex items-center justify-between p-3 border-b border-zinc-800">
<div className="flex items-center text-lg font-medium">
<div className="flex items-center justify-between p-3 border-b border-neutral-400">
<div className="flex items-center text-lg font-bold">
{formatTime(solve.time)}
<span className="text-xs text-red-500">
{solve.plus2 ? "+2" : null}
</span>
</div>
<div>{formatDate(solve.endTime)}</div>
<div className="flex items-center gap-3">
<div className="text-neutral-600">
<CalendarDays />
</div>
<div className="flex flex-col text-end">
<div>{formatDate(solve.endTime)}</div>
<div>
{new Date(solve.endTime).getHours()}:
{new Date(solve.endTime).getMinutes()}
</div>
</div>
</div>
</div>
<div className="flex flex-col items-center justify-between p-3 font-medium border-b border-zinc-800 text-md">
<div>{solve.scramble}</div>
<div className="flex flex-col items-center justify-between p-3 font-medium border-b border-neutral-400 text-md">
<div className="text-md">{solve.scramble}</div>
<ScrambleDisplay
className="w-full h-32 my-3"
show={status}
Expand All @@ -91,11 +103,11 @@ export default function ModalSolve() {
></ScrambleDisplay>
</div>

<div className="relative flex items-center justify-center gap-3 p-3 border-b light border-zinc-800">
<div className="flex items-center justify-center gap-3 p-3 border-b light border-zinc-800">
{!isAllSolve() && (
<button
type="button"
className="absolute flex items-center justify-center w-12 h-8 p-1 transition duration-500 border rounded-md left-3 top-3 hover:text-neutral-800 bg-neutral-300 hover:border-zinc-400 border-zinc-600"
className="flex items-center justify-center w-12 h-8 p-1 transition duration-500 border rounded-md left-3 top-3 hover:text-neutral-800 bg-neutral-300 hover:border-zinc-400 border-zinc-600"
onClick={() => handleMove()}
>
<svg
Expand Down
Loading