From ff20d531c28cad92ea827a9516807f4b70cf3446 Mon Sep 17 00:00:00 2001 From: Hydra Date: Mon, 13 May 2024 02:02:55 +0100 Subject: [PATCH] feat: improving buttons on gallery slider --- src/locales/en/translation.json | 4 +- src/locales/pt/translation.json | 4 +- src/renderer/src/components/modal/modal.tsx | 9 +- .../pages/game-details/gallery-slider.css.ts | 100 +++++++++++------- .../src/pages/game-details/gallery-slider.tsx | 81 ++++++++------ 5 files changed, 127 insertions(+), 71 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 0674d1b5..f3c5719e 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -96,7 +96,9 @@ "dont_show_it_again": "Don't show it again", "copy_to_clipboard": "Copy", "copied_to_clipboard": "Copied", - "got_it": "Got it" + "got_it": "Got it", + "previous_screenshot": "Previous screenshot", + "next_screenshot": "Next screenshot" }, "activation": { "title": "Activate Hydra", diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index dda53065..bb29957a 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -92,7 +92,9 @@ "dont_show_it_again": "Não mostrar novamente", "copy_to_clipboard": "Copiar", "copied_to_clipboard": "Copiado", - "got_it": "Entendi" + "got_it": "Entendi", + "previous_screenshot": "Captura de tela anterior", + "next_screenshot": "Próxima captura de tela" }, "activation": { "title": "Ativação", diff --git a/src/renderer/src/components/modal/modal.tsx b/src/renderer/src/components/modal/modal.tsx index 79308c1e..82c3b481 100644 --- a/src/renderer/src/components/modal/modal.tsx +++ b/src/renderer/src/components/modal/modal.tsx @@ -24,6 +24,7 @@ export function Modal({ }: ModalProps) { const [isClosing, setIsClosing] = useState(false); const modalContentRef = useRef(null); + const titleRef = useRef(null); const { t } = useTranslation("modal"); @@ -52,6 +53,8 @@ export function Modal({ useEffect(() => { if (visible) { + if (titleRef.current) titleRef.current.focus(); + const onKeyDown = (e: KeyboardEvent) => { if (e.key === "Escape" && isTopMostModal()) { handleCloseClick(); @@ -94,8 +97,10 @@ export function Modal({ >
-

{title}

- {description &&

{description}

} +

+ {title} +

+ {description &&

{description}

}
- - - )} + + +
@@ -144,7 +156,9 @@ export function GallerySlider({ gameDetails }: GallerySliderProps) { loading="lazy" onClick={() => setMediaIndex(i)} src={video.thumbnail} - className={`${styles.gallerySliderMediaPreview} ${mediaIndex === i ? styles.gallerySliderMediaPreviewActive : ""}`} + className={styles.gallerySliderMediaPreview({ + active: mediaIndex === i, + })} /> ))} {gameDetails.screenshots && @@ -158,7 +172,12 @@ export function GallerySlider({ gameDetails }: GallerySliderProps) { i + (gameDetails.movies ? gameDetails.movies.length : 0) ) } - className={`${styles.gallerySliderMediaPreview} ${mediaIndex === i + (gameDetails.movies ? gameDetails.movies.length : 0) ? styles.gallerySliderMediaPreviewActive : ""}`} + className={styles.gallerySliderMediaPreview({ + active: + mediaIndex === + i + + (gameDetails.movies ? gameDetails.movies.length : 0), + })} src={image.path_full} /> )