From 3977dccd648c1875e7b6529b9b4fbc0aac00e80e Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Tue, 30 Dec 2025 17:15:19 +0200 Subject: [PATCH] Refactor stuff from common.css to CSS Modules --- app/components/Alert.module.css | 56 + app/components/Alert.tsx | 11 +- app/components/Avatar.module.css | 4 + app/components/Avatar.tsx | 3 +- app/components/Chart.module.css | 34 + app/components/Chart.tsx | 17 +- .../CustomizedColorsInput.module.css | 80 ++ app/components/CustomizedColorsInput.tsx | 23 +- app/components/Divider.module.css | 28 + app/components/Divider.tsx | 7 +- app/components/FormErrors.module.css | 7 + app/components/FormErrors.tsx | 3 +- app/components/FormMessage.module.css | 13 + app/components/FormMessage.tsx | 3 +- app/components/Image.module.css | 8 + app/components/Image.tsx | 7 +- app/components/InfoPopover.module.css | 24 + app/components/InfoPopover.tsx | 12 +- app/components/Input.module.css | 60 + app/components/Input.tsx | 7 +- app/components/Label.module.css | 24 + app/components/Label.tsx | 14 +- app/components/Pagination.module.css | 44 + app/components/Pagination.tsx | 11 +- app/components/RequiredHiddenInput.module.css | 8 + app/components/RequiredHiddenInput.tsx | 4 +- app/components/Section.module.css | 12 + app/components/Section.tsx | 4 +- app/components/SubNav.module.css | 63 + app/components/SubNav.tsx | 17 +- app/components/Table.module.css | 38 + app/components/Table.tsx | 6 +- app/components/TimePopover.module.css | 14 + app/components/TimePopover.tsx | 6 +- app/components/YouTubeEmbed.module.css | 18 + app/components/YouTubeEmbed.tsx | 7 +- .../art/components/ArtGrid.module.css | 81 ++ app/features/art/components/ArtGrid.tsx | 13 +- app/features/articles/routes/a.module.css | 12 + app/features/articles/routes/a.tsx | 9 +- .../calendar/components/Tags.module.css | 49 + app/features/calendar/components/Tags.tsx | 16 +- app/features/chat/components/Chat.module.css | 110 ++ app/features/chat/components/Chat.tsx | 43 +- .../components/TopTenPlayer.module.css | 24 + .../leaderboards/components/TopTenPlayer.tsx | 9 +- app/features/links/routes/links.module.css | 11 + app/features/links/routes/links.tsx | 5 +- .../components/ModeMapPoolPicker.module.css | 135 ++ .../components/ModeMapPoolPicker.tsx | 37 +- app/styles/common.css | 1190 +---------------- app/styles/utils.css | 97 ++ 52 files changed, 1223 insertions(+), 1315 deletions(-) create mode 100644 app/components/Alert.module.css create mode 100644 app/components/Avatar.module.css create mode 100644 app/components/Chart.module.css create mode 100644 app/components/CustomizedColorsInput.module.css create mode 100644 app/components/Divider.module.css create mode 100644 app/components/FormErrors.module.css create mode 100644 app/components/FormMessage.module.css create mode 100644 app/components/Image.module.css create mode 100644 app/components/InfoPopover.module.css create mode 100644 app/components/Input.module.css create mode 100644 app/components/Label.module.css create mode 100644 app/components/Pagination.module.css create mode 100644 app/components/RequiredHiddenInput.module.css create mode 100644 app/components/Section.module.css create mode 100644 app/components/SubNav.module.css create mode 100644 app/components/Table.module.css create mode 100644 app/components/TimePopover.module.css create mode 100644 app/components/YouTubeEmbed.module.css create mode 100644 app/features/art/components/ArtGrid.module.css create mode 100644 app/features/articles/routes/a.module.css create mode 100644 app/features/calendar/components/Tags.module.css create mode 100644 app/features/chat/components/Chat.module.css create mode 100644 app/features/leaderboards/components/TopTenPlayer.module.css create mode 100644 app/features/links/routes/links.module.css create mode 100644 app/features/sendouq-settings/components/ModeMapPoolPicker.module.css diff --git a/app/components/Alert.module.css b/app/components/Alert.module.css new file mode 100644 index 000000000..1bef9c87a --- /dev/null +++ b/app/components/Alert.module.css @@ -0,0 +1,56 @@ +.alert { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + border-radius: var(--rounded); + background-color: var(--color-info-low); + color: var(--color-info-high); + font-size: var(--fonts-sm); + font-weight: var(--semi-bold); + gap: var(--s-2); + margin-inline: auto; + padding-block: var(--s-1-5); + padding-inline: var(--s-3) var(--s-4); + text-align: center; + + & > svg { + height: 1.75rem; + fill: var(--color-info); + } +} + +.tiny { + font-size: var(--fonts-xs); + + & > svg { + height: 1.25rem; + } +} + +.warning { + background-color: var(--color-warning-low); + color: var(--color-warning-high); + + & > svg { + fill: var(--color-warning); + } +} + +.error { + background-color: var(--color-error-low); + color: var(--color-error-high); + + & > svg { + fill: var(--color-error); + } +} + +.success { + background-color: var(--color-success-low); + color: var(--color-success-high); + + & > svg { + fill: var(--color-success); + } +} diff --git a/app/components/Alert.tsx b/app/components/Alert.tsx index d5860711b..cb61fccff 100644 --- a/app/components/Alert.tsx +++ b/app/components/Alert.tsx @@ -1,6 +1,7 @@ import clsx from "clsx"; import type * as React from "react"; import { assertUnreachable } from "~/utils/types"; +import styles from "./Alert.module.css"; import { AlertIcon } from "./icons/Alert"; import { CheckmarkIcon } from "./icons/Checkmark"; import { ErrorIcon } from "./icons/Error"; @@ -22,11 +23,11 @@ export function Alert({ }) { return (
| {t("custom.colors.contrast.first-color")} | @@ -160,8 +159,10 @@ export function CustomizedColorsInput({{t(`custom.colors.${contrast.colors[1]}`)} | {contrast.contrast.AA.failed ? ( @@ -173,8 +174,10 @@ export function CustomizedColorsInput({ |
{contrast.contrast.AAA.failed ? (
diff --git a/app/components/Divider.module.css b/app/components/Divider.module.css
new file mode 100644
index 000000000..a61f1a97f
--- /dev/null
+++ b/app/components/Divider.module.css
@@ -0,0 +1,28 @@
+.divider {
+ display: flex;
+ width: 100%;
+ align-items: center;
+ color: var(--color-text-accent);
+ font-size: var(--fonts-lg);
+ text-align: center;
+
+ &::before,
+ &::after {
+ flex: 1;
+ min-width: 1rem;
+ border-bottom: 2px solid var(--color-bg-high);
+ content: "";
+ }
+
+ &:not(:empty)::before {
+ margin-right: 0.25em;
+ }
+
+ &:not(:empty)::after {
+ margin-left: 0.25em;
+ }
+}
+
+.smallText {
+ font-size: var(--fonts-sm);
+}
diff --git a/app/components/Divider.tsx b/app/components/Divider.tsx
index d4d49bbf2..6514a5b39 100644
--- a/app/components/Divider.tsx
+++ b/app/components/Divider.tsx
@@ -1,4 +1,5 @@
import clsx from "clsx";
+import styles from "./Divider.module.css";
export function Divider({
children,
@@ -10,7 +11,11 @@ export function Divider({
smallText?: boolean;
}) {
return (
-
+
{children}
);
diff --git a/app/components/FormErrors.module.css b/app/components/FormErrors.module.css
new file mode 100644
index 000000000..b3069c015
--- /dev/null
+++ b/app/components/FormErrors.module.css
@@ -0,0 +1,7 @@
+.container {
+ font-size: var(--fonts-sm);
+
+ & > h4 {
+ color: var(--color-error);
+ }
+}
diff --git a/app/components/FormErrors.tsx b/app/components/FormErrors.tsx
index c6c8edf94..51b50af0e 100644
--- a/app/components/FormErrors.tsx
+++ b/app/components/FormErrors.tsx
@@ -1,6 +1,7 @@
import { useActionData } from "@remix-run/react";
import { useTranslation } from "react-i18next";
import type { Namespace } from "~/modules/i18n/resources.server";
+import styles from "./FormErrors.module.css";
export function FormErrors({ namespace }: { namespace: Namespace }) {
const { t } = useTranslation(["common", namespace]);
@@ -11,7 +12,7 @@ export function FormErrors({ namespace }: { namespace: Namespace }) {
}
return (
-
+ {t("common:forms.errors.title")}:
diff --git a/app/components/Image.module.css b/app/components/Image.module.css
new file mode 100644
index 000000000..d877ae152
--- /dev/null
+++ b/app/components/Image.module.css
@@ -0,0 +1,8 @@
+.tierContainer {
+ display: grid;
+}
+
+.tierImg {
+ grid-column: 1;
+ grid-row: 1;
+}
diff --git a/app/components/Image.tsx b/app/components/Image.tsx
index aea53e143..c28410722 100644
--- a/app/components/Image.tsx
+++ b/app/components/Image.tsx
@@ -19,6 +19,7 @@ import {
TIER_PLUS_URL,
tierImageUrl,
} from "~/utils/urls";
+import styles from "./Image.module.css";
interface ImageProps {
path: string;
@@ -229,14 +230,14 @@ export function TierImage({ tier, className, width = 200 }: TierImageProps) {
const height = width * 0.8675;
return (
-
+
- {leftAddon ? {leftAddon} : null}
+ {leftAddon ? {leftAddon} : null}
label {
+ margin: 0;
+ }
+}
+
+.value {
+ color: var(--color-text-high);
+ font-size: var(--fonts-xxs);
+ margin-block-start: -5px;
+}
+
+.valueWarning {
+ color: var(--color-warning);
+}
+
+.valueError {
+ color: var(--color-error);
+}
diff --git a/app/components/Label.tsx b/app/components/Label.tsx
index 89382874b..d24829ed3 100644
--- a/app/components/Label.tsx
+++ b/app/components/Label.tsx
@@ -1,4 +1,5 @@
import clsx from "clsx";
+import styles from "./Label.module.css";
type LabelProps = Pick<
React.DetailedHTMLProps<
@@ -27,12 +28,12 @@ export function Label({
spaced = true,
}: LabelProps) {
return (
-
+
{valueLimits ? (
-
+
{valueLimits.current}/{valueLimits.max}
) : null}
@@ -40,9 +41,12 @@ export function Label({
);
}
-function lengthWarning(valueLimits: NonNullable
+
+
{nullFilledArray(pagesCount).map((_, i) => (
// biome-ignore lint/a11y/noStaticElementInteractions: Biome v2 migration
setPage(i + 1)}
/>
))}
-
+
{currentPage}/{pagesCount}
{title}}{children}
|
|---|