From d3e209907f44fa8f5c62b0786b2ab312ed5604f5 Mon Sep 17 00:00:00 2001 From: Johnomated <34685272+Johnomated@users.noreply.github.com> Date: Fri, 26 Jul 2024 23:15:46 -0500 Subject: [PATCH 1/3] Content can be centered on large screens with NEXT_PUBLIC_CENTERED_ON_LARGE_SCREENS env variable Added CENTERED_LARGE_SCREENS variable in config.ts that gets NEXT_PUBLIC_CENTERED_ON_LARGE_SCREENS value from environment variables. Modified SiteGrid.tsx to use CENTERED_LARGE_SCREENS and adjust the pages column layout if it's true. --- src/app/layout.tsx | 3 +++ src/components/SiteGrid.tsx | 16 ++++++++++++++-- src/site/config.ts | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 59aaec56..7fff3211 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,6 +4,7 @@ import { clsx } from 'clsx/lite'; import { IBM_Plex_Mono } from 'next/font/google'; import { BASE_URL, + CENTERED_LARGE_SCREENS, DEFAULT_THEME, SITE_DESCRIPTION, SITE_DOMAIN_OR_TITLE, @@ -27,6 +28,8 @@ const ibmPlexMono = IBM_Plex_Mono({ subsets: ['latin'], weight: ['400', '500', '700'], variable: '--font-ibm-plex-mono', + display: 'swap', // font wouldn't load in vercel dev environment, solution from link below + // https://stackoverflow.com/a/76484168 }); export const metadata: Metadata = { diff --git a/src/components/SiteGrid.tsx b/src/components/SiteGrid.tsx index 931fec17..6d04648a 100644 --- a/src/components/SiteGrid.tsx +++ b/src/components/SiteGrid.tsx @@ -1,5 +1,6 @@ import { clsx } from 'clsx/lite'; import { RefObject } from 'react'; +import { CENTERED_LARGE_SCREENS } from '@/site/config'; export default function SiteGrid({ containerRef, @@ -25,18 +26,29 @@ export default function SiteGrid({ 'gap-x-4 lg:gap-x-6', 'gap-y-4', 'max-w-7xl', + CENTERED_LARGE_SCREENS && 'mx-auto', className, )} >
{contentMain}
{contentSide &&
diff --git a/src/site/config.ts b/src/site/config.ts index a7097cc6..ad01fbd8 100644 --- a/src/site/config.ts +++ b/src/site/config.ts @@ -155,6 +155,8 @@ export const SHOW_FILM_SIMULATIONS = process.env.NEXT_PUBLIC_HIDE_FILM_SIMULATIONS !== '1'; export const SHOW_EXIF_DATA = process.env.NEXT_PUBLIC_HIDE_EXIF_DATA !== '1'; +export const CENTERED_LARGE_SCREENS = + process.env.NEXT_PUBLIC_CENTERED_ON_LARGE_SCREENS === '1'; export const GRID_ASPECT_RATIO = process.env.NEXT_PUBLIC_GRID_ASPECT_RATIO ? parseFloat(process.env.NEXT_PUBLIC_GRID_ASPECT_RATIO) From 1b45eb41ae20ddba76b30877de33e6748d515719 Mon Sep 17 00:00:00 2001 From: Johnomated <34685272+Johnomated@users.noreply.github.com> Date: Sat, 27 Jul 2024 00:23:07 -0500 Subject: [PATCH 2/3] Changed centering breakpoint from lg to xl --- src/components/SiteGrid.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/SiteGrid.tsx b/src/components/SiteGrid.tsx index 6d04648a..b119e196 100644 --- a/src/components/SiteGrid.tsx +++ b/src/components/SiteGrid.tsx @@ -32,10 +32,10 @@ export default function SiteGrid({ >
@@ -44,10 +44,10 @@ export default function SiteGrid({ {contentSide &&
Date: Sat, 27 Jul 2024 10:16:22 -0500 Subject: [PATCH 3/3] Edited /components/Badge.tsx to be a block element If the text for tags/cameras on the grid page overflowed to a second line then the background did not grow with the text. Making the element a block and slightly increasing the padding keeps the text/background similar to the original style while also allowing the background to match the text if it is multiple lines. --- src/components/Badge.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Badge.tsx b/src/components/Badge.tsx index 47505733..380b1dba 100644 --- a/src/components/Badge.tsx +++ b/src/components/Badge.tsx @@ -28,7 +28,9 @@ export default function Badge({ case 'small': return clsx( 'h-max-baseline', - 'px-[5px] py-[2.75px]', + // 'px-[5px] py-[2.75px]', //original padding + 'block', // added to keep gray background around text when overflowed + 'px-[6px] py-[5px]', // increased padding for block and to stop content shift 'text-[0.7rem] font-medium rounded-[0.25rem]', highContrast ? 'text-invert bg-invert'