From 7cb3c4dc96e99364f96768df8edc8fa516579872 Mon Sep 17 00:00:00 2001 From: YourUsername Date: Sun, 30 Jun 2024 13:26:36 +0300 Subject: [PATCH] fixed google chrome mobile x scrolling --- src/components/DynamicImage.jsx | 7 ------- src/main.jsx | 10 +++++----- src/pages/Results/GenerationList.jsx | 12 ++++++------ src/pages/Results/ResultsScreen.jsx | 2 +- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/components/DynamicImage.jsx b/src/components/DynamicImage.jsx index 156fc26..3180841 100644 --- a/src/components/DynamicImage.jsx +++ b/src/components/DynamicImage.jsx @@ -2,7 +2,6 @@ import { useEffect, useRef, useState } from "preact/hooks" import { Icon } from "./Icon" import { Spinner } from "./Spinner" -// TODO убери export const ResponsiveRect = ({ size = null, aspect = "1024/1024", children = null, className = "", ...props }) => { if (!!size) { const [width, height] = size.split("x") @@ -18,10 +17,6 @@ export const ResponsiveRect = ({ size = null, aspect = "1024/1024", children = n ) } -// TODO -// убрать ResponsiveRect из DynamicImage -// DynamicImage всегда максимально расширяется? - export const DynamicImage = ({ src, className = "", children = null, ...props }) => { const [loaded, setLoaded] = useState(false) const [error, setError] = useState(false) @@ -36,8 +31,6 @@ export const DynamicImage = ({ src, className = "", children = null, ...props }) setError(false) }, [src]) - // TODO useEffect(..., [loaded]) - - return (
{!error && ( diff --git a/src/main.jsx b/src/main.jsx index 7a7a4b2..3b666b8 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -1,7 +1,7 @@ -import { render } from 'preact' -import { App } from './app.jsx' +import { render } from "preact" +import { App } from "./app.jsx" -import './styles/tailwind.css' -import '@fontsource-variable/inter'; +import "./styles/tailwind.css" +import "@fontsource-variable/inter" -render(, document.getElementById('app')) +render(, document.getElementById("app")) diff --git a/src/pages/Results/GenerationList.jsx b/src/pages/Results/GenerationList.jsx index 67adbd7..3cac168 100644 --- a/src/pages/Results/GenerationList.jsx +++ b/src/pages/Results/GenerationList.jsx @@ -1,3 +1,4 @@ +import { GenerationRequest, GenerationResult } from "@/api/schemas" import { DynamicImage } from "@/components/DynamicImage" import { HStack } from "@/components/HStack" import { Icon } from "@/components/Icon" @@ -11,18 +12,17 @@ const TallIconButton = ({ icon, onClick = undefined }) => { const GenerationEntry = ({ generation = null, isSelected = false, isGenerating = false, ...props }) => { const selected = isSelected ? "outline outline-3 outline-blue-500 shadow" : "" - const baseStyle = "h-full aspect-square cursor-pointer rounded object-cover snap-center hover:opacity-75" + const baseStyle = "cursor-pointer snap-center hover:opacity-75 min-w-20 w-20 h-20" return ( <> {generation.isError || generation.isGenerating ? ( -
+
{generation.isError && } {generation.isGenerating && }
) : ( - // - + )} ) @@ -46,10 +46,10 @@ export const GenerationList = ({ generations, selected, setSelected }) => { }, [selected]) return ( - + - + {generations.map((gen, index) => { return ( 0 && ( <> - + todo uncomment