Skip to content

Commit

Permalink
desktopVW, mobileVW
Browse files Browse the repository at this point in the history
  • Loading branch information
clementroche committed Nov 24, 2024
1 parent cd65638 commit b30153c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libs/utils.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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<string, unknown>) {
Expand Down

1 comment on commit b30153c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚡️ Lighthouse report for the changes in this commit:

🟢 Performance: 98
🟢 Accessibility: 90
🟢 Best practices: 96
🟠 SEO: 63

Lighthouse ran on https://satus-jq07352hk-darkroom-engineering.vercel.app/

Please sign in to comment.