From 57a8368b3b15d23075b3270904b997093a1e1928 Mon Sep 17 00:00:00 2001 From: Hachi-R Date: Sun, 19 Jan 2025 16:35:21 -0300 Subject: [PATCH] refactor: migrate download page styles from VE to SCSS + BEM --- .../pages/downloads/delete-game-modal.scss | 11 ++ .../src/pages/downloads/delete-game-modal.tsx | 6 +- .../src/pages/downloads/download-group.scss | 140 ++++++++++++++++++ .../src/pages/downloads/download-group.tsx | 59 ++------ .../src/pages/downloads/downloads.scss | 37 +++++ .../src/pages/downloads/downloads.tsx | 10 +- 6 files changed, 211 insertions(+), 52 deletions(-) create mode 100644 src/renderer/src/pages/downloads/delete-game-modal.scss create mode 100644 src/renderer/src/pages/downloads/download-group.scss create mode 100644 src/renderer/src/pages/downloads/downloads.scss diff --git a/src/renderer/src/pages/downloads/delete-game-modal.scss b/src/renderer/src/pages/downloads/delete-game-modal.scss new file mode 100644 index 00000000..5846b8b1 --- /dev/null +++ b/src/renderer/src/pages/downloads/delete-game-modal.scss @@ -0,0 +1,11 @@ +@use "../../scss/globals.scss"; + +.delete-game-modal { + &__actions { + display: flex; + width: 100%; + justify-content: flex-end; + align-items: center; + gap: globals.$spacing-unit; + } +} diff --git a/src/renderer/src/pages/downloads/delete-game-modal.tsx b/src/renderer/src/pages/downloads/delete-game-modal.tsx index e4ff7f9e..e9486652 100644 --- a/src/renderer/src/pages/downloads/delete-game-modal.tsx +++ b/src/renderer/src/pages/downloads/delete-game-modal.tsx @@ -1,8 +1,6 @@ import { useTranslation } from "react-i18next"; - import { Button, Modal } from "@renderer/components"; - -import * as styles from "./delete-game-modal.css"; +import "./delete-game-modal.scss"; interface DeleteGameModalProps { visible: boolean; @@ -29,7 +27,7 @@ export function DeleteGameModal({ description={t("delete_modal_description")} onClose={onClose} > -
+
diff --git a/src/renderer/src/pages/downloads/download-group.scss b/src/renderer/src/pages/downloads/download-group.scss new file mode 100644 index 00000000..504ec73a --- /dev/null +++ b/src/renderer/src/pages/downloads/download-group.scss @@ -0,0 +1,140 @@ +@use "../../scss/globals.scss"; + +.download-group { + display: flex; + flex-direction: column; + gap: calc(globals.$spacing-unit * 2); + + &__header { + display: flex; + align-items: center; + justify-content: space-between; + gap: calc(globals.$spacing-unit * 2); + + &-divider { + flex: 1; + background-color: globals.$color-border; + height: 1px; + } + + &-count { + font-weight: 400; + } + } + + &__title-wrapper { + display: flex; + align-items: center; + margin-bottom: globals.$spacing-unit; + gap: globals.$spacing-unit; + } + + &__title { + font-weight: bold; + cursor: pointer; + color: globals.$color-body; + text-align: left; + font-size: 16px; + display: block; + + &:hover { + text-decoration: underline; + } + } + + &__downloads { + width: 100%; + gap: calc(globals.$spacing-unit * 2); + display: flex; + flex-direction: column; + margin: 0; + padding: 0; + margin-top: globals.$spacing-unit; + } + + &__item { + width: 100%; + background-color: globals.$color-background; + display: flex; + border-radius: 8px; + border: solid 1px globals.$color-border; + overflow: hidden; + box-shadow: 0px 0px 5px 0px #000000; + transition: all ease 0.2s; + height: 140px; + min-height: 140px; + max-height: 140px; + position: relative; + } + + &__cover { + width: 280px; + min-width: 280px; + height: auto; + border-right: solid 1px globals.$color-border; + position: relative; + z-index: 1; + + &-content { + width: 100%; + height: 100%; + padding: globals.$spacing-unit; + display: flex; + align-items: flex-end; + justify-content: flex-end; + } + + &-backdrop { + width: 100%; + height: 100%; + background: linear-gradient( + 0deg, + rgba(0, 0, 0, 0.8) 5%, + transparent 100% + ); + display: flex; + overflow: hidden; + z-index: 1; + } + + &-image { + width: 100%; + height: 100%; + position: absolute; + z-index: -1; + } + } + + &__right-content { + display: flex; + padding: calc(globals.$spacing-unit * 2); + flex: 1; + gap: globals.$spacing-unit; + background: linear-gradient(90deg, transparent 20%, rgb(0 0 0 / 20%) 100%); + } + + &__details { + display: flex; + flex-direction: column; + flex: 1; + justify-content: center; + gap: calc(globals.$spacing-unit / 2); + font-size: 14px; + } + + &__actions { + display: flex; + align-items: center; + gap: globals.$spacing-unit; + } + + &__menu-button { + position: absolute; + top: 12px; + right: 12px; + border-radius: 50%; + border: none; + padding: 8px; + min-height: unset; + } +} diff --git a/src/renderer/src/pages/downloads/download-group.tsx b/src/renderer/src/pages/downloads/download-group.tsx index 88cf1433..192a4428 100644 --- a/src/renderer/src/pages/downloads/download-group.tsx +++ b/src/renderer/src/pages/downloads/download-group.tsx @@ -12,9 +12,8 @@ import { Downloader, formatBytes, steamUrlBuilder } from "@shared"; import { DOWNLOADER_NAME } from "@renderer/constants"; import { useAppSelector, useDownload } from "@renderer/hooks"; -import * as styles from "./download-group.css"; +import "./download-group.scss"; import { useTranslation } from "react-i18next"; -import { SPACING_UNIT, vars } from "@renderer/theme.css"; import { useMemo } from "react"; import { DropdownMenu, @@ -238,54 +237,36 @@ export function DownloadGroup({ if (!library.length) return null; return ( -
-
+
+

{title}

- -
-

{library.length}

+
+

{library.length}

-
    +
      {library.map((game) => { return ( -
    • -
      -
      +
    • +
      +
      {game.title} -
      +
      {DOWNLOADER_NAME[game.downloader]}
      -
      -
      -
      +
      +
      +