From 4379d7599ba63ed491ca2e437d102086da359976 Mon Sep 17 00:00:00 2001 From: m5r Date: Wed, 12 Aug 2026 22:33:58 +0200 Subject: [PATCH] milestone 23 s3: convert features/groups/GroupsPage.tsx to stylex --- web/src/features/groups/GroupsPage.tsx | 135 ++++++++++++++++++++----- 1 file changed, 111 insertions(+), 24 deletions(-) diff --git a/web/src/features/groups/GroupsPage.tsx b/web/src/features/groups/GroupsPage.tsx index 29685f9..8e0c77c 100644 --- a/web/src/features/groups/GroupsPage.tsx +++ b/web/src/features/groups/GroupsPage.tsx @@ -1,5 +1,6 @@ import { useState } from "react"; import { useMutation, useQueryClient, useSuspenseQuery } from "@tanstack/react-query"; +import * as stylex from "@stylexjs/stylex"; import { blocklistsQuery, groupCreateMutation, @@ -10,13 +11,85 @@ import { import type { Blocklist, Group } from "@/lib/types"; import GroupSourcesEditor from "./GroupSourcesEditor"; import InlineError from "@/lib/InlineError"; -import { focusRing, primaryButtonClass, smallButtonClass, smallInputClass } from "@/ui/classes"; +import { styles as shared } from "@/ui/styles"; +import { colors } from "@/ui/tokens.stylex"; import { DEFAULT_GROUP_ID } from "@/lib/defaultGroup"; import { READ_ONLY_HINT, useReadOnlyConfig } from "@/features/settings/authority"; const DEFAULT_GROUP_NOTE = "The default group cannot be renamed or deleted."; -const groupButtonClass = `${smallButtonClass} disabled:opacity-50`; +const styles = stylex.create({ + heading: { + fontSize: "1.5rem", + lineHeight: "2rem", + fontWeight: 600, + }, + createForm: { + marginTop: "1rem", + display: "flex", + flexWrap: "wrap", + alignItems: "center", + gap: "0.5rem", + }, + fieldLabel: { + fontSize: "0.875rem", + lineHeight: "1.25rem", + fontWeight: 500, + }, + list: { + display: "flex", + flexDirection: "column", + gap: "1rem", + marginTop: "1.5rem", + }, + row: { + borderRadius: "0.25rem", + borderWidth: 1, + borderStyle: "solid", + borderColor: colors.border, + padding: "1rem", + }, + rowControls: { + display: "flex", + flexWrap: "wrap", + alignItems: "center", + gap: "0.75rem", + }, + renameForm: { + display: "flex", + alignItems: "center", + gap: "0.5rem", + }, + name: { + fontWeight: 500, + }, + checkboxLabel: { + display: "inline-flex", + alignItems: "center", + gap: "0.5rem", + fontSize: "0.875rem", + lineHeight: "1.25rem", + }, + actions: { + marginLeft: "auto", + display: "inline-flex", + flexWrap: "wrap", + alignItems: "center", + gap: "0.5rem", + }, + groupButton: { + opacity: { default: 1, ":disabled": 0.5 }, + }, + destructive: { + color: colors.danger, + }, + lockNote: { + marginTop: "0.5rem", + fontSize: "0.75rem", + lineHeight: "1rem", + color: colors.textMuted, + }, +}); export default function GroupsPage() { const { data: groups } = useSuspenseQuery(groupsQuery()); @@ -28,9 +101,9 @@ export default function GroupsPage() { return (
-

Groups

+

Groups

{ event.preventDefault(); const name = newName.trim(); @@ -38,7 +111,7 @@ export default function GroupsPage() { createMutation.mutate({ name }, { onSuccess: () => setNewName("") }); }} > -