Skip to content

Commit

Permalink
fix story etc
Browse files Browse the repository at this point in the history
  • Loading branch information
ashharrison90 committed Nov 19, 2023
1 parent 5ae14a9 commit 85b629b
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 28 deletions.
2 changes: 1 addition & 1 deletion components/Header/Header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
top: 0;
transition: top 0.2s ease-in-out;
width: 100%;
z-index: 1;
z-index: 2;
}

.nav {
Expand Down
8 changes: 0 additions & 8 deletions components/Layout/Layout.module.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
.container {
height: 100%;
width: 100%;
}

.heroContent {
box-shadow: inset 0 0 60px 0 black;
display: flex;
flex-direction: column;
position: relative;
width: 100%;
}

.contentContainer {
Expand Down
5 changes: 2 additions & 3 deletions components/Layout/Layout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const meta: Meta<typeof Layout> = {
title: 'Components/Layout',
component: Layout,
args: {
backgroundContent: (
heroContent: (
<div
style={{
backgroundColor: 'red',
Expand All @@ -16,7 +16,7 @@ const meta: Meta<typeof Layout> = {
}}
/>
),
backgroundHeight: 50,
heroHeight: 50,
children: (
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
Expand All @@ -28,7 +28,6 @@ const meta: Meta<typeof Layout> = {
mollit anim id est laborum.
</p>
),
foregroundContent: <h1>HELLO</h1>,
hideHeaderUntilScroll: false,
metaDescription: 'The description seen on Google',
metaTitle: 'The title seen on Google',
Expand Down
4 changes: 2 additions & 2 deletions components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ const Layout = forwardRef<HTMLDivElement, Props>(
}, [hideHeaderUntilScroll])

return (
<div ref={containerRef} className={styles.container}>
<div ref={containerRef}>
<Head>
<title>{metaTitle}</title>
<meta name='description' content={metaDescription} />
</Head>
<Header show={showHeader} ref={headerRef} />
<div
style={{
height: `${heroHeight}%`,
height: `${heroHeight}vh`,
}}
className={styles.heroContent}
>
Expand Down
12 changes: 7 additions & 5 deletions components/PostLayout/PostLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ export default function PostLayout({ children, metadata }: Props) {
const ctx = gsap.context(() => {
gsap.from(`.${layoutStyles.heroContent}`, {
duration: 0.5,
height: '100%',
height: '100vh',
ease: 'back',
delay: 0.1,
})

gsap.to('[data-speed]', {
y: (i, el) =>
(1 - parseFloat(el.getAttribute('data-speed'))) *
ScrollTrigger.maxScroll(window),
-(
parseFloat(el.getAttribute('data-speed')) *
ScrollTrigger.maxScroll(window)
),
ease: 'none',
scrollTrigger: {
start: 0,
start: '0',
end: 'max',
scrub: true,
},
Expand Down Expand Up @@ -90,7 +92,7 @@ export default function PostLayout({ children, metadata }: Props) {
const hero = (
<img
alt=''
data-speed='1.05'
data-speed='0.05'
className={styles.coverImage}
src={coverImage}
/>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test-e2e-ci": "start-server-and-test serve http://localhost:3000 test-e2e",
"test-e2e-headed": "PWDEBUG=1 npx playwright test __test__/e2e --headed",
"test-lighthouse": "lhci autorun",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"storybook": "storybook dev"
},
"devDependencies": {
Expand Down
16 changes: 9 additions & 7 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ export default function Home({ allPosts }: Props) {
const ctx = gsap.context(() => {
gsap.to('[data-speed]', {
y: (i, el) =>
(1 - parseFloat(el.getAttribute('data-speed'))) *
ScrollTrigger.maxScroll(window),
-(
parseFloat(el.getAttribute('data-speed')) *
ScrollTrigger.maxScroll(window)
),
ease: 'none',
scrollTrigger: {
start: 0,
start: '0',
end: 'max',
scrub: true,
},
Expand All @@ -42,15 +44,15 @@ export default function Home({ allPosts }: Props) {
<>
{!pageLoaded && (
<img
data-speed='1.05'
data-speed='0.05'
alt=''
src='/assets/home/hero-fallback.webp'
data-testid='heroFallback'
className={classnames(styles.fallback)}
/>
)}
<img
data-speed='1.05'
data-speed='0.05'
onLoad={() => setPageLoaded(true)}
alt='A nice background'
src='/assets/home/hero-background.webp'
Expand All @@ -60,15 +62,15 @@ export default function Home({ allPosts }: Props) {
})}
/>
<img
data-speed='1.15'
data-speed='0.15'
alt='Me'
src='/assets/home/hero-cutout.webp'
data-testid='heroCutout'
className={classnames(styles.heroCutout, {
[styles.hide]: !pageLoaded,
})}
/>
<div className={styles.heroTitleContainer}>
<div data-speed='1' className={styles.heroTitleContainer}>
<h1>
<Typewriter
options={{
Expand Down
2 changes: 1 addition & 1 deletion styles/Home.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
justify-content: flex-end;
max-width: 1024px;
padding: 0 1em;
position: relative;
position: fixed;
width: 100%;

h1 {
Expand Down

0 comments on commit 85b629b

Please sign in to comment.