From 6be7ba29287a97b734c2a7e27c4671272a50a4a0 Mon Sep 17 00:00:00 2001 From: Desel72 Date: Mon, 23 Mar 2026 04:53:55 -0500 Subject: [PATCH] refactor(web): replace MediaType enum with const object (#33834) --- web/eslint-suppressions.json | 5 ----- web/hooks/use-breakpoints.ts | 14 ++++++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json index a645a408cf..04e8be3afd 100644 --- a/web/eslint-suppressions.json +++ b/web/eslint-suppressions.json @@ -9795,11 +9795,6 @@ "count": 6 } }, - "hooks/use-breakpoints.ts": { - "erasable-syntax-only/enums": { - "count": 1 - } - }, "hooks/use-format-time-from-now.spec.ts": { "regexp/no-dupe-disjunctions": { "count": 5 diff --git a/web/hooks/use-breakpoints.ts b/web/hooks/use-breakpoints.ts index e0bd45c01c..f31a335c5b 100644 --- a/web/hooks/use-breakpoints.ts +++ b/web/hooks/use-breakpoints.ts @@ -1,13 +1,15 @@ 'use client' import * as React from 'react' -export enum MediaType { - mobile = 'mobile', - tablet = 'tablet', - pc = 'pc', -} +export const MediaType = { + mobile: 'mobile', + tablet: 'tablet', + pc: 'pc', +} as const -const useBreakpoints = () => { +type MediaTypeValue = (typeof MediaType)[keyof typeof MediaType] + +const useBreakpoints = (): MediaTypeValue => { const [width, setWidth] = React.useState(globalThis.innerWidth) const media = (() => { if (width <= 640)