refactor(web): replace MediaType enum with const object (#33834)

This commit is contained in:
Desel72 2026-03-23 04:53:55 -05:00 committed by GitHub
parent 2c8322c7b9
commit 6be7ba2928
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 11 deletions

View File

@ -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

View File

@ -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)