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/8] 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/8] 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/8] 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' From 1fbe63454f33405c8b084e18ee6b7ac3d98ee5d5 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 11 Aug 2024 12:29:44 -0400 Subject: [PATCH 4/8] Document explicit specs to --- src/app/layout.tsx | 3 --- src/components/Badge.tsx | 4 +--- src/components/SiteGrid.tsx | 24 ++++++++++-------------- src/site/config.ts | 2 -- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 7fff3211..59aaec56 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,7 +4,6 @@ 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, @@ -28,8 +27,6 @@ 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/Badge.tsx b/src/components/Badge.tsx index 380b1dba..47505733 100644 --- a/src/components/Badge.tsx +++ b/src/components/Badge.tsx @@ -28,9 +28,7 @@ export default function Badge({ case 'small': return clsx( 'h-max-baseline', - // '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 + 'px-[5px] py-[2.75px]', 'text-[0.7rem] font-medium rounded-[0.25rem]', highContrast ? 'text-invert bg-invert' diff --git a/src/components/SiteGrid.tsx b/src/components/SiteGrid.tsx index b119e196..6c8e38d8 100644 --- a/src/components/SiteGrid.tsx +++ b/src/components/SiteGrid.tsx @@ -1,6 +1,13 @@ import { clsx } from 'clsx/lite'; import { RefObject } from 'react'; -import { CENTERED_LARGE_SCREENS } from '@/site/config'; + +/* + Max widths (lg and up) + Main: 954px + + Sidebar: 302px + + Gap: 24px = + Total: 1280px +*/ export default function SiteGrid({ containerRef, @@ -26,29 +33,18 @@ 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 ad01fbd8..a7097cc6 100644 --- a/src/site/config.ts +++ b/src/site/config.ts @@ -155,8 +155,6 @@ 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 16da4fc8a8d6c896a06ede89b29e752b492d6bf3 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 11 Aug 2024 13:12:11 -0400 Subject: [PATCH 5/8] Optically center layouts @ new 3xl breakpoint --- src/app/layout.tsx | 4 ++++ src/components/SiteGrid.tsx | 7 +++++-- tailwind.config.js | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 59aaec56..b53741ad 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -87,6 +87,10 @@ export default function RootLayout({