1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-12-22 04:15:56 +01:00
upscayl/renderer/components/settings-tab/ImageScaleSelect.tsx

45 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-02-08 15:57:35 +01:00
import { useCustomWidthAtom } from "@/atoms/userSettingsAtom";
import { useAtom } from "jotai";
2023-07-22 13:07:53 +02:00
import React from "react";
type ImageScaleSelectProps = {
scale: "4" | "2" | "3";
setScale: (arg: "4" | "2" | "3") => void;
};
export function ImageScaleSelect({ scale, setScale }: ImageScaleSelectProps) {
2024-02-08 15:57:35 +01:00
const [useCustomWidth, setUseCustomWidth] = useAtom(useCustomWidthAtom);
2023-07-22 13:07:53 +02:00
return (
2024-02-08 15:57:35 +01:00
<div className={`${useCustomWidth && "opacity-50"}`}>
2023-07-22 13:07:53 +02:00
<div className="flex flex-row gap-1">
2024-02-08 15:57:35 +01:00
<p className="text-sm font-medium">
IMAGE SCALE {useCustomWidth && "DISABLED"}
</p>
2023-11-23 06:39:46 +01:00
{/*
<p className="badge-primary badge text-[10px] font-medium">
EXPERIMENTAL
2023-11-23 06:39:46 +01:00
</p> */}
2023-07-22 13:07:53 +02:00
</div>
<input
2024-02-08 15:57:35 +01:00
disabled={useCustomWidth}
2023-07-22 13:07:53 +02:00
type="range"
2023-07-23 08:32:22 +02:00
min="1"
2023-07-22 13:07:53 +02:00
max="4"
value={scale}
onChange={(e: any) => {
setScale(e.target.value.toString());
}}
step="1"
className="range range-primary mt-2"
/>
<div className="flex w-full justify-between px-2 text-xs font-semibold text-base-content">
2023-07-23 08:32:22 +02:00
<span>1x</span>
2023-07-22 13:07:53 +02:00
<span>2x</span>
<span>3x</span>
<span>4x</span>
</div>
</div>
);
}