Skip to content

Commit

Permalink
Redesign (initial iteration)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgraham committed Oct 8, 2024
1 parent 87ebc6b commit 8c10718
Show file tree
Hide file tree
Showing 55 changed files with 1,111 additions and 802 deletions.
9 changes: 2 additions & 7 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ module.exports = {
title: 'Adam Graham',
siteUrl: 'https://adamgraham.github.io',
description:
'Adam Graham is a professional software engineer and game developer inspired by a passion for art, design, and engineering.',
'Adam is a software engineer and game developer inspired by the blending of art, design, and engineering to create best in class user experiences.',
},
plugins: [
{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: 'UA-61761892-1',
},
},
{
resolve: 'gatsby-plugin-manifest',
options: {
Expand All @@ -24,6 +18,7 @@ module.exports = {
icon: 'static/logo512.png',
},
},
'gatsby-plugin-use-query-params',
'gatsby-plugin-react-helmet',
'gatsby-plugin-sitemap',
'gatsby-plugin-portal',
Expand Down
2 changes: 1 addition & 1 deletion gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const HtmlAttributes = {
const HeadComponents = [
<link key="fonts.googleapis.com" rel="preconnect" href="https://fonts.googleapis.com"></link>, // prettier-ignore
<link key="fonts.gstatic.com" rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="true"></link>, // prettier-ignore
<link key="poppins" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&38;display=swap" rel="stylesheet"></link>, // prettier-ignore
<link key="inter" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&38;display=swap" rel="stylesheet"></link>, // prettier-ignore
<link key="material-icons" href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"></link>, // prettier-ignore
];

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
"gatsby-plugin-react-helmet": "^5.17.0",
"gatsby-plugin-sharp": "^4.17.0",
"gatsby-plugin-sitemap": "^5.17.0",
"gatsby-plugin-use-query-params": "^1.0.1",
"gatsby-source-filesystem": "^4.17.0",
"gatsby-transformer-json": "^4.17.0",
"gatsby-transformer-sharp": "^4.17.0",
"gh-pages": "^4.0.0",
"prop-types": "^15.8.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-helmet": "^6.1.0"
"react-helmet": "^6.1.0",
"use-query-params": "^2.2.1"
},
"devDependencies": {
"eslint": "^8.18.0",
Expand Down
44 changes: 26 additions & 18 deletions src/components/Gallery.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,53 @@
import '../styles/gallery.css';
import { useMediaQuery } from '@zigurous/react-components';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React, { useContext } from 'react';
import GalleryContext from './GalleryContext';
import Slide from './Slide';
import icons from '../icons';
import '../styles/gallery.css';

const Gallery = ({ className }) => {
const context = useContext(GalleryContext);
const verticalLayout = useMediaQuery('(max-width: 1365px)');
const vertical = useMediaQuery('(max-width: 1365px)');
return (
<article
className={classNames(
'gallery',
{ 'gallery--vertical-layout': verticalLayout },
className
)}
<div
className={classNames('gallery', {
'gallery--vertical': vertical,
className,
})}
>
<button
aria-label="Previous Slide"
className="gallery__button left"
disabled={context.slideIndex <= 0}
className="gallery__button previous"
onClick={() => context.setSlideIndex(context.slideIndex - 1)}
>
{context.slideIndex > 0 && <img alt="" src={icons.chevronLeft} />}
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="48px"
height="48px"
>
<path d="M14.71 6.71c-.39-.39-1.02-.39-1.41 0L8.71 11.3c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41z" />
</svg>
</button>
<div className="gallery__slides">
{context.currentSlide && <Slide slide={context.currentSlide} />}
</div>
<button
aria-label="Next Slide"
className="gallery__button right"
disabled={context.slideIndex >= context.gallery.length - 1}
className="gallery__button next"
onClick={() => context.setSlideIndex(context.slideIndex + 1)}
>
{context.slideIndex < context.gallery.length - 1 && (
<img alt="" src={icons.chevronRight} />
)}
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="48px"
height="48px"
>
<path d="M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01z" />
</svg>
</button>
</article>
</div>
);
};

Expand Down
25 changes: 11 additions & 14 deletions src/components/GalleryContext.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import { navigate } from 'gatsby';
import { createContext, useMemo } from 'react';
import { setSessionIndex } from '../utils/session';

export const useContext = (category, gallery, slideIndex, setSlideIndex) => {
return useMemo(
() => ({
export const useContextState = (category, slides = [], slideIndex) => {
return useMemo(() => {
return {
category,
gallery,
slides,
slideIndex,
currentSlide: gallery[slideIndex],
currentSlide: slides[slideIndex],
setSlideIndex: (index) => {
index = Math.min(Math.max(index, 0), gallery.length - 1);
setSessionIndex(category, index);
setSlideIndex(index);
navigate(`/${category}`);
if (index >= slides.length) index = 0;
if (index < 0) index = slides.length - 1;
navigate(`/${category}?index=${index}`);
},
}),
[category, gallery, slideIndex]
);
};
}, [category, slides, slideIndex]);
};

const GalleryContext = createContext({
category: '',
gallery: [],
slides: [],
slideIndex: 0,
currentSlide: null,
setSlideIndex: () => {},
Expand Down
35 changes: 0 additions & 35 deletions src/components/GalleryPage.js

This file was deleted.

123 changes: 123 additions & 0 deletions src/components/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import '../styles/header.css';
import { Link, NavBar, SocialNavLinks } from '@zigurous/react-components';
import { Link as GatsbyLink } from 'gatsby';
import PropTypes from 'prop-types';
import React, { useContext } from 'react';
import GalleryContext from './GalleryContext';
import { navLinks, socialLinks } from '../links';
import { titleCase } from '../utils/formatting';

const Header = ({ location, isMenuOpen, toggleMenu }) => {
const gallery = useContext(GalleryContext);
return (
<header className="header">
<div className="header__container container-fluid">
<div>
<Link className="logo h4" ElementType={GatsbyLink} to="/" unstyled>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
width="44px"
height="44px"
>
<polygon points="345.17 257.56 233.75 257.56 212.47 294.58 324.06 294.58 382.6 396.41 425 396.41 345.17 257.56" />
<polygon points="168.69 322.35 254.36 173.36 286.8 229.79 329.2 229.79 254.36 99.59 105 359.38 333.5 359.38 312.21 322.35 168.69 322.35" />
</svg>
</Link>
<NavBar
links={navLinks}
LinkElementType={GatsbyLink}
location={location}
/>
{/* {gallery.slideIndex === undefined && !fullscreen && (
<Link
className="header__slide-title h4 display-none margin-bottom-none"
ElementType={GatsbyLink}
to={`/${category}`}
unstyled
>
{titleCase(category)}
</Link>
)}
{gallery.slideIndex !== undefined && (
<div
className="header__slide-buttons display-none"
style={{ marginLeft: '-8px' }}
>
<button
aria-label="Previous Slide"
onClick={() => gallery.setSlideIndex(gallery.slideIndex - 1)}
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="48px"
height="48px"
>
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M14.71 6.71c-.39-.39-1.02-.39-1.41 0L8.71 11.3c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41z" />
</svg>
</button>
<button
aria-label="Next Slide"
className="margin-left-md"
onClick={() => gallery.setSlideIndex(gallery.slideIndex + 1)}
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="48px"
height="48px"
>
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01z" />
</svg>
</button>
</div>
)} */}
</div>
<div>
<SocialNavLinks
className="margin-left-md margin-right-xl"
iconSize={20}
iconInnerPadding={10}
links={socialLinks}
/>
<button
aria-label={isMenuOpen ? 'Close Menu' : 'Open Menu'}
className="header__menu-button"
onClick={toggleMenu}
>
{isMenuOpen ? (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="36px"
height="36px"
>
<path d="M3 18h13v-2H3v2zm0-5h10v-2H3v2zm0-7v2h13V6H3zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5L21 15.59z" />
</svg>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="36px"
height="36px"
>
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" />
</svg>
)}
</button>
</div>
</div>
</header>
);
};

Header.propType = {
location: PropTypes.object,
isMenuOpen: PropTypes.bool,
toggleMenu: PropTypes.func,
};

export default Header;
Loading

0 comments on commit 8c10718

Please sign in to comment.