1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-30 18:24:27 +01:00
upscayl/renderer/components/ImageOptions.tsx

97 lines
3.4 KiB
TypeScript
Raw Permalink Normal View History

import React, { useEffect } from "react";
2022-11-23 19:24:30 +01:00
2022-12-16 17:20:46 +01:00
const ImageOptions = ({
zoomAmount,
setZoomAmount,
2022-12-21 16:43:54 +01:00
resetImagePaths,
2022-12-24 08:40:45 +01:00
hideZoomOptions,
2022-12-16 17:20:46 +01:00
}: {
2022-12-21 11:32:45 +01:00
zoomAmount: string;
2022-12-16 17:20:46 +01:00
setZoomAmount: (arg: any) => void;
2022-12-21 16:43:54 +01:00
resetImagePaths: () => void;
2022-12-24 08:40:45 +01:00
hideZoomOptions?: boolean;
2022-12-16 17:20:46 +01:00
}) => {
useEffect(() => {
if (!localStorage.getItem("zoomAmount")) {
localStorage.setItem("zoomAmount", zoomAmount);
} else {
setZoomAmount(localStorage.getItem("zoomAmount"));
2022-12-16 17:20:46 +01:00
}
}, []);
2022-12-16 17:20:46 +01:00
2022-11-23 19:24:30 +01:00
return (
2023-03-12 09:36:36 +01:00
<div className="animate rounded-btn collapse fixed top-1 z-50 m-2 backdrop-blur-lg">
2022-11-23 19:24:30 +01:00
<input type="checkbox" className="peer" />
2023-03-12 09:36:36 +01:00
{/* <div className="peer-checked:outline-title-none collapse-title bg-opacity-25 text-center text-sm font-semibold uppercase backdrop-blur-2xl peer-checked:bg-base-300 peer-checked:text-base-content"> */}
<div className="outline-title peer-checked:outline-title-none collapse-title text-center text-sm font-semibold uppercase text-black mix-blend-difference outline-2 peer-checked:bg-base-300 peer-checked:text-base-content">
2022-11-23 19:24:30 +01:00
Show/Hide Image Settings
</div>
<div className="collapse-content bg-base-100 text-base-content">
2022-12-16 17:20:46 +01:00
<div className="flex max-h-96 flex-col justify-center gap-5 overflow-auto p-5">
2022-12-21 16:43:54 +01:00
<button className="btn-primary btn" onClick={resetImagePaths}>
Reset Image
</button>
2022-12-24 08:40:45 +01:00
{!hideZoomOptions && (
<div className="flex flex-row items-center gap-2">
<p className="w-20">Zoom:</p>
<button
className={`btn-primary btn ${
zoomAmount === "100%" ? "btn-secondary" : "btn-primary"
}`}
onClick={() => {
setZoomAmount("100%");
localStorage.setItem("zoomAmount", "100%");
}}>
100%
</button>
<button
className={`btn-primary btn ${
zoomAmount === "125%" ? "btn-secondary" : "btn-primary"
}`}
onClick={() => {
setZoomAmount("125%");
localStorage.setItem("zoomAmount", "125%");
}}>
125%
</button>
<button
className={`btn-primary btn ${
zoomAmount === "150%" ? "btn-secondary" : "btn-primary"
}`}
onClick={() => {
setZoomAmount("150%");
localStorage.setItem("zoomAmount", "150%");
}}>
150%
</button>
<button
className={`btn-primary btn ${
zoomAmount === "175%" ? "btn-secondary" : "btn-primary"
}`}
onClick={() => {
setZoomAmount("175%");
localStorage.setItem("zoomAmount", "175%");
}}>
175%
</button>
<button
className={`btn-primary btn ${
zoomAmount === "200%" ? "btn-secondary" : "btn-primary"
}`}
onClick={() => {
setZoomAmount("200%");
localStorage.setItem("zoomAmount", "200%");
}}>
200%
</button>
</div>
)}
2022-11-23 19:24:30 +01:00
</div>
</div>
</div>
);
};
export default ImageOptions;