From b30153c937cdb5b32493b0c574c069c61b8c554f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Roche?= Date: Sun, 24 Nov 2024 12:06:37 +0100 Subject: [PATCH] desktopVW, mobileVW --- libs/utils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/utils.ts b/libs/utils.ts index d2ed55d1..d9b8bc8f 100644 --- a/libs/utils.ts +++ b/libs/utils.ts @@ -1,9 +1,11 @@ +import { screens } from "~/styles/config.mjs" + export function desktopVW(value: number, width: number) { - return (value * width) / 1440 + return (value * width) / screens.desktop.width } export function mobileVW(value: number, width: number) { - return (value * width) / 375 + return (value * width) / screens.mobile.width } export function twoDigits(number: number) { @@ -23,7 +25,7 @@ export function capitalizeFirstLetter(inputString: string) { } export function numberWithCommas(x: { toString: () => string }) { - return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") } export function isEmptyObject(obj: Record) {