-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68ad5a9
commit eaab226
Showing
48 changed files
with
635 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { Home } from '@home'; | ||
import { type SectionId, sectionTitles } from '@lib/site'; | ||
|
||
const Section = ({ id, color }: { id: SectionId; color: string }) => { | ||
return ( | ||
<section id={id} style={{ height: '100vh', backgroundColor: color }}> | ||
<h1>{sectionTitles[id]}</h1> | ||
</section> | ||
); | ||
}; | ||
|
||
const meta: Meta<typeof Home.Header> = { | ||
title: 'Home/Header', | ||
component: Home.Header, | ||
render: () => { | ||
return ( | ||
<> | ||
<Home.Header /> | ||
<Section id="home" color="black" /> | ||
<Section id="about" color="lightblue" /> | ||
<Section id="portfolio" color="lightgray" /> | ||
<Section id="career" color="lightblue" /> | ||
<Section id="medium" color="lightgray" /> | ||
</> | ||
); | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Header: StoryObj<typeof Home.Header> = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { css, cx, toProps } from '@lib/css'; | ||
import { theme } from '@theme'; | ||
|
||
const { decl, vars } = theme; | ||
|
||
const root = (float: boolean) => { | ||
const base = css` | ||
--header-font-size: var(${vars.font.size.stepN2}); | ||
--header-padding: var(${vars.spacing.step7}); | ||
--header-height: calc((var(--header-font-size}) + var(--header-padding}) * 2)); | ||
left: 0; | ||
padding-right: 50px; | ||
position: fixed; | ||
right: 0; | ||
top: 0; | ||
z-index: 1000; | ||
transition: background-color 1s; | ||
font-size: var(--header-font-size); | ||
`; | ||
|
||
const floating = css` | ||
${decl.color.background.dark}; | ||
`; | ||
|
||
return toProps(float ? cx(base, floating) : base); | ||
}; | ||
|
||
export default { root }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { GithubCorner as Corner } from '@components/github'; | ||
|
||
import { Navigation } from '../navigation'; | ||
|
||
import { HeaderLogo as Logo } from './header_logo'; | ||
|
||
import styles from './header.styles'; | ||
|
||
const SCROLL_THRESHOLD = 200; | ||
|
||
export interface HeaderProps { | ||
isLocal?: boolean; | ||
} | ||
|
||
const Component = ({ isLocal }: HeaderProps) => { | ||
const [isFloating, setIsFloating] = useState(false); | ||
|
||
useEffect(() => { | ||
const handleScroll = () => { | ||
if (window.scrollY >= SCROLL_THRESHOLD) { | ||
setIsFloating(true); | ||
} else { | ||
setIsFloating(false); | ||
} | ||
}; | ||
|
||
window.addEventListener('scroll', handleScroll); | ||
|
||
return () => { | ||
window.removeEventListener('scroll', handleScroll); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<header {...styles.root(isFloating)}> | ||
<Header.Logo /> | ||
<Header.Navigation {...{ isLocal }} /> | ||
<Header.Corner /> | ||
</header> | ||
); | ||
}; | ||
|
||
export const Header = Object.assign(Component, { | ||
Logo, | ||
Navigation, | ||
Corner, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { css, toProps } from '@lib/css'; | ||
import { theme } from '@theme'; | ||
|
||
const { vars } = theme; | ||
|
||
// @ts-expect-error - required for loading the logo | ||
import logo from '../../../content/images/logo.png?h=50&format=webp'; | ||
|
||
const root = toProps(css` | ||
padding-top: var(${vars.spacing.step4}); | ||
padding-left: var(${vars.spacing.step7}); | ||
padding-bottom: var(${vars.spacing.step4}); | ||
position: absolute; | ||
`); | ||
|
||
const link = toProps( | ||
css` | ||
--logo-height: calc(var(${vars.spacing.step6}) + var(${vars.font.size.stepN2})); | ||
--logo-width: calc(var(--logo-height) * 3); | ||
text-indent: -1000px; | ||
height: var(--logo-height); | ||
width: var(--logo-width); | ||
background-size: contain; | ||
overflow: hidden; | ||
display: block; | ||
`, | ||
{ backgroundImage: `url(${logo})` }, | ||
); | ||
|
||
export default { root, link }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import styles from './header_logo.styles'; | ||
|
||
export interface HeaderLogoProps { | ||
isLocal?: boolean; | ||
} | ||
|
||
export const HeaderLogo = ({ isLocal = false }: HeaderLogoProps) => { | ||
return ( | ||
<h1 {...styles.root}> | ||
<a {...styles.link} href={isLocal ? '#' : '/'}> | ||
Clint Andrew Hall | ||
</a> | ||
</h1> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Header } from './header'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { Footer } from './footer'; | ||
export { Header } from './header'; | ||
export { Layout, type LayoutProps } from './layout'; | ||
export { Section, type SectionProps } from './section'; | ||
export { Section, type SectionHeaderProps, type SectionProps } from './section'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { Navigation, type NavigationProps } from './navigation'; | ||
export { NavigationLink, type NavigationLinkProps } from './navigation_link'; |
Oops, something went wrong.