Skip to content

Commit

Permalink
feat: added global constants
Browse files Browse the repository at this point in the history
  • Loading branch information
niebag committed Apr 18, 2024
1 parent 80ad3bc commit 9415bee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions next.constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

import { env } from "~/env";

/**
* This is used to verify if the current site is running on a development environment.
*/
export const IS_DEVELOPMENT = env.NODE_ENV === 'development';
6 changes: 3 additions & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Metadata } from 'next';
import { IS_DEVELOPMENT } from 'next.constants.mjs';
import { Inter } from 'next/font/google';

import { ScreenSize } from '~/components/atoms/utils/ScreenSize';
import { env } from '~/env';
import '~/styles/globals.css';
import '~/styles/tailwind.css';

Expand All @@ -24,8 +24,8 @@ export default function RootLayout({
{children}

{/* In development mode, render a fixed component displaying the current viewport
width and corresponding Tailwind breakpoint, as a helper for responsive design. */}
{env.NODE_ENV === 'development' && <ScreenSize />}
width and corresponding Tailwind breakpoint, as a helper for responsive design. */}
{IS_DEVELOPMENT && <ScreenSize />}
</body>
</html>
);
Expand Down

0 comments on commit 9415bee

Please sign in to comment.