2024-09-01 14:01:45 +02:00
|
|
|
import { translationAtom } from "@/atoms/translations-atom";
|
2024-10-04 11:15:54 +02:00
|
|
|
import { tileSizeAtom } from "@/atoms/user-settings-atom";
|
2024-09-01 14:01:45 +02:00
|
|
|
import { useAtom, useAtomValue } from "jotai";
|
2024-04-24 21:40:48 +02:00
|
|
|
import React from "react";
|
|
|
|
|
2024-10-04 11:15:54 +02:00
|
|
|
export function InputTileSize() {
|
2024-04-24 21:40:48 +02:00
|
|
|
const [tileSize, setTileSize] = useAtom(tileSizeAtom);
|
2024-09-01 14:01:45 +02:00
|
|
|
const t = useAtomValue(translationAtom);
|
2024-04-24 21:40:48 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className="flex flex-col gap-1">
|
2024-09-01 14:01:45 +02:00
|
|
|
<p className="text-sm font-medium">
|
2024-09-03 09:34:58 +02:00
|
|
|
{t("SETTINGS.CUSTOM_TILE_SIZE.TITLE")}
|
2024-09-01 14:01:45 +02:00
|
|
|
</p>
|
2024-04-24 21:40:48 +02:00
|
|
|
<p className="text-xs text-base-content/80">
|
|
|
|
<br />
|
2024-09-03 09:34:58 +02:00
|
|
|
{t("SETTINGS.CUSTOM_TILE_SIZE.DESCRIPTION")}
|
2024-04-24 21:40:48 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div className="mt-2 flex items-center gap-2">
|
|
|
|
<input
|
|
|
|
type="number"
|
|
|
|
value={tileSize}
|
|
|
|
onChange={(e) => {
|
|
|
|
if (e.currentTarget.value === "") {
|
|
|
|
setTileSize(null);
|
|
|
|
localStorage.removeItem("customWidth");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
setTileSize(parseInt(e.currentTarget.value));
|
|
|
|
}}
|
|
|
|
placeholder="0 = Auto"
|
|
|
|
className="input input-primary [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|