From 055e2092a00a87175f408d157bb952a334e560cf Mon Sep 17 00:00:00 2001 From: Paul Scott Date: Thu, 19 Dec 2024 00:53:53 -0500 Subject: [PATCH] style updates --- app/components/card/card.module.scss | 7 ++-- app/components/footer/footer.tsx | 2 +- app/components/header/header.module.scss | 2 +- app/components/section/section.tsx | 12 +++---- app/page.tsx | 44 +++++++++++------------- 5 files changed, 33 insertions(+), 34 deletions(-) diff --git a/app/components/card/card.module.scss b/app/components/card/card.module.scss index 5619c23..94a237f 100644 --- a/app/components/card/card.module.scss +++ b/app/components/card/card.module.scss @@ -3,7 +3,6 @@ .card { @include content-border; position: relative; - transition: 0.1s; aspect-ratio: 4/3; background-color: $menu-color; overflow: hidden; @@ -15,7 +14,8 @@ left: 0; width: 100%; padding: 1rem; - background-color: rgba($content-color, 0.75); + background-color: rgba($content-color, 0.85); + border-top: $border-size solid $content-border-color1; } .title { @@ -35,7 +35,8 @@ } .link:hover { - filter: brightness(75%); + @include double-border($content-border-color2, $content-border-color1); + cursor: pointer; } .linkIcon { diff --git a/app/components/footer/footer.tsx b/app/components/footer/footer.tsx index bdbc581..cd95fce 100644 --- a/app/components/footer/footer.tsx +++ b/app/components/footer/footer.tsx @@ -6,7 +6,7 @@ export default function Footer() { Email at pauljscott8@gmail.com{" "} or call at (215) 880-9592
- Updated December 11th, 2024 + Updated December 19th, 2024 ); } diff --git a/app/components/header/header.module.scss b/app/components/header/header.module.scss index 1ac07d0..3018161 100644 --- a/app/components/header/header.module.scss +++ b/app/components/header/header.module.scss @@ -78,6 +78,6 @@ margin: 0 0.5rem; &:hover { - filter: brightness(75%); + outline: $border-size dotted black; } } diff --git a/app/components/section/section.tsx b/app/components/section/section.tsx index d0c9678..4d53470 100644 --- a/app/components/section/section.tsx +++ b/app/components/section/section.tsx @@ -13,7 +13,7 @@ export type SectionData = { export type SectionProps = { data: SectionData; - flexShrink: number; + fewerColumns: number; }; function getCardWidth(columns: number): string { @@ -23,12 +23,12 @@ function getCardWidth(columns: number): string { return "calc(" + width + " - " + lessWidth + ")"; } -function getCardDims(columns: number, lessColumns: number): CardDims { +function getCardDims(columns: number, fewerColumns: number): CardDims { const dims = new CardDims(); - const columnsAdjusted = Math.max(columns - lessColumns, 1); + const columnsAdjusted = Math.max(columns - fewerColumns, 1); dims.width = getCardWidth(columnsAdjusted); - if (columnsAdjusted == 2 && lessColumns == 2) { + if (columnsAdjusted == 2 && fewerColumns == 2) { dims.titleSize = variables.mediumFontSize; dims.descriptionSize = variables.smallFontSize; dims.labelPadding = `calc(${variables.cardSpacing} / 2)`; @@ -41,14 +41,14 @@ function getCardDims(columns: number, lessColumns: number): CardDims { return dims; } -export default function Section({ data, flexShrink }: SectionProps) { +export default function Section({ data, fewerColumns }: SectionProps) { let cards: JSX.Element[] = []; for (let cardData of data.content) { cards.push( ); diff --git a/app/page.tsx b/app/page.tsx index fff41be..2aa2552 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -7,23 +7,28 @@ import styles from "./page.module.scss"; import { useEffect, useState } from "react"; import Footer from "./components/footer/footer"; -const mobileCutoff = 640; -const tabletCutoff = 1024; - -const mobileFlexShrink = 2; -const tabletFlexShrink = 1; -const desktopFlexShrink = 0; - -function getFlexShrink(window: Window): number { - return window.innerWidth <= mobileCutoff - ? mobileFlexShrink - : window.innerWidth <= tabletCutoff - ? tabletFlexShrink - : desktopFlexShrink; -} +const MOBILE_CUTOFF = 640; +const TABLET_CUTOFF = 1024; + +const MOBILE_COLUMN_ADJUST = 2; +const TABLET_COLUMN_ADJUST = 1; export default function Home() { - const [flexShrink, setFlexShrink] = useState(0); + const [fewerColumns, setFewerColumns] = useState(0); + + const refreshFewerColumns = () => + setFewerColumns( + window.innerWidth <= MOBILE_CUTOFF + ? MOBILE_COLUMN_ADJUST + : window.innerWidth <= TABLET_CUTOFF + ? TABLET_COLUMN_ADJUST + : 0 + ); + + useEffect(() => { + window.addEventListener("resize", refreshFewerColumns); + refreshFewerColumns(); + }, []); let sections: JSX.Element[] = []; content.forEach((sectionData: SectionData) => { @@ -31,18 +36,11 @@ export default function Home() {
); }); - useEffect(() => { - window.addEventListener("resize", () => - setFlexShrink(getFlexShrink(window)) - ); - setFlexShrink(getFlexShrink(window)); - }, []); - return (