Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOEOPSFY24-296 | explore framer motion hero multi-overlay #4

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/Container/Container.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const widths = {
};

export const bgColors = {
black: 'bg--black text-white',
black: 'bg-black text-white',
white: 'bg-white text-black',
'fog-light': 'bg-fog-light text-black',
'red-gradient': 'bg-soe-red-gradient text-white',
Expand Down
4 changes: 4 additions & 0 deletions app/components/FeatureHero/FeatureHero.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const root = 'h-full max-h-[1200px] relative overflow-hidden';
export const wrapper = 'mr-0 au-ml-auto flex-col lg:flex-row';
export const gradient = 'absolute top-0 left-0 bg-feature-gradient-rl bg-feature-gradient-bt w-full h-full z-30';
export const contentWrapper = 'lg:rs-pr-9 ml-0 *:text-white z-50';
50 changes: 50 additions & 0 deletions app/components/FeatureHero/FeatureHero.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'use client'

import { HTMLAttributes } from 'react';
import { Container } from '../Container';
import { FlexBox } from '../FlexBox';
// import * as styles from './FeatureHero.styles';
import Image from 'next/image';
import ShapeA from '../images/shape-a';
import { motion, useScroll, useTransform } from 'framer-motion';

type FeatureHeroProps = HTMLAttributes<HTMLDivElement> & {
children: React.ReactNode;
imageSrc?: string;
};

export const FeatureHero = ({
children,
...props
}: FeatureHeroProps) => {
const { scrollYProgress } = useScroll();
const opacity = useTransform(scrollYProgress, [0, 0.05], [1, 0]);


return (
<FlexBox {...props} as="section" alignItems="start" justifyContent="between" className="relative flex-col bg-soe-black h-auto w-full aspect-[16/9]">
<Container width="full" className='order-last flex flex-col rs-p-9 *:text-white z-50 lg:max-w-[50%] *:font-dm-sans bg-soe-black lg:bg-transparent'>
{children}
</Container>
<div className="relative w-full bg-cool-grey lg:absolute lg:top-0 lg:left-0 h-auto z-10">
<Image className="absolute top-0 left-0 lg:left-[300px] z-0 w-full h-auto"
alt=""
src={`soe-centennial-nextjs/assets/images/Hawa-Racine-Thiam.jpg`}
width={0}
height={0}
sizes="100vw" />
<motion.div className="absolute w-full h-full top-0 left-0 z-10" style={{ opacity }} >
<div className="w-full h-full bg-plum-dark absolute top-0 left-0 z-10" />
<ShapeA className="absolute bottom-10 left-10 lg:left-[300px] z-20 *:stroke-plum" height={1200} />
</motion.div>
<div className='absolute top-0 left-0 bg-transparent lg:bg-feature-gradient-rl bg-feature-gradient-bt w-full h-full z-50' />
<Image className="absolute top-0 left-0 lg:left-[300px] z-20 w-full h-auto"
alt=""
src={`soe-centennial-nextjs/assets/images/Hawa-Racine-Thiam_silhouette.png`}
width={0}
height={0}
sizes="100vw" />
<div className='absolute top-0 left-0 bg-feature-gradient-bt w-full h-full z-50' />
</div>
</FlexBox>
)};
2 changes: 2 additions & 0 deletions app/components/FeatureHero/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './FeatureHero';
export * from './FeatureHero.styles';
4 changes: 2 additions & 2 deletions app/components/ShapeAnimation/ShapeAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export const ShapeAnimation = () => {
}, [pathIndex, currentPath]);

return (
<div>
<motion.svg width="500px" height="100%" viewBox="0 0 1820 1700">
<div className="cc rs-py-2">
<motion.svg width="100%" height="500px" viewBox="0 0 1820 1700">
<motion.path d={currentPath} fill="none" stroke="black" strokeWidth="3" />
</motion.svg>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/components/TimelineBanner/TimelineBanner.styles.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const root = 'overflow-hidden';
export const wrapper = 'mr-0 au-ml-auto flex-col lg:flex-row';
export const contentWrapper = 'lg:rs-pr-9 ml-0';
export const contentWrapper = 'lg:rs-pr-9 ml-0 flex flex-col';
export const heading = '2xl:whitespace-pre-line -mt-01em rs-mb-2 xl:max-w-1200';
export const superhead = 'order-first';
export const superhead = 'order-first mb-38';
export const body = 'max-w-[50ch] rs-mb-3 *:*:leading-snug';
export const imageWrapper = 'group relative w-300 h-300 perspective-600';
export const image = 'object-cover w-full h-full transform rotate-y-30 group-hocus:-rotate-y-30 skew-y-12 ease-in duration-300 rounded-[30px]';
2 changes: 1 addition & 1 deletion app/components/Typography/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactNode, TimeHTMLAttributes } from 'react';
import { cnb } from 'cnbuilder';
import { HeroIcon, type HeroIconProps, type IconType } from '../HeroIcon';
import { HeroIcon, type HeroIconProps, type IconType } from '../images/HeroIcon';
import * as styles from './typography.styles';
import * as types from './typography.types';

Expand Down
16 changes: 16 additions & 0 deletions app/components/images/shape-a.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { HtmlHTMLAttributes } from 'react';

type Props = HtmlHTMLAttributes<SVGSVGElement> & {
height?: number
width?: number | string
}

const ShapeA = ({ height = 900, width = '100%', ...props }: Props) => {
return (
<svg {...props} width={width} height={height} viewBox="0 0 1106 1678" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.00037 408.703C2.00037 241.336 0.326884 187.778 222.899 187.778C445.471 187.778 699.839 187.778 781.839 187.778C929.104 187.778 930.778 2 781.839 2C632.9 2 408.654 2 335.021 2C130.857 2 149.266 355.145 335.021 355.145C520.777 355.145 833.716 355.145 907.349 355.145C1133.27 355.145 1149.15 505.985 1032.86 674.817C929.104 825.448 509.063 1392.82 432.083 1494.92C384.638 1557.84 326.401 1636.94 264.735 1660.61C135.222 1710.32 2.00037 1635.51 2.00037 1494.92C2.00037 1122.69 2.00037 615.681 2.00037 408.703Z" stroke="#F83535" stroke-width="3" />
</svg>
);
};

export default ShapeA;
21 changes: 20 additions & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import { Heading } from '@/components/Typography';
import { Heading, Text } from '@/components/Typography';
import { ShapeAnimation } from '@/components/ShapeAnimation';
import { TimelineBanner } from '@/components/TimelineBanner';
import { FeatureHero } from './components/FeatureHero';

export default function Home() {
return (
<div>
<Heading>SOE Centennial</Heading>
<FeatureHero>
<Heading
as="h1"
leading="none"
className="2xl:whitespace-pre-line font-normal -mt-01em rs-mb-8 xl:max-w-1200"
>
Exploring the reengineering of immune cells
</Heading>
<Text variant="overview" weight="normal" className="order-first mb-38 underline underline-offset-[6px] decoration-2 decoration-digital-red-xlight">
Change Makers
</Text>
<Text variant="overview" weight="normal" className="max-w-[50ch] rs-mb-3 *:*:leading-snug">
The Sarafan ChEM-H Institute scholar is building a multidisciplinary lab to explore the reengineering of immune cells. Before coming to Stanford, she says, “I was thinking in terms of understanding. Now I feel that I can start thinking in terms of creating.”
</Text>
<Text variant="overview" weight="normal" className="max-w-[50ch] rs-mb-3 *:*:leading-snug">
by Jess Alvarenga
</Text>
</FeatureHero>
<ShapeAnimation />
<TimelineBanner heading='Headline lorem ipsum dolar sit' superhead='1983' body="Cras felis tortor, bibendum quis porttitor at, ullamcorper eu diam. Aenean iaculis efficitur quam, quis dignissim lacus. Cras nec dui id mi blandit lobortis eget in enim." />
</div>
Expand Down
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const nextConfig = {
basePath: '/soe-centennial-nextjs',
output: 'export',
reactStrictMode: true,
images: { unoptimized: true },
};

export default nextConfig;
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "eslint \"{components,utilities}/**/*.{ts,tsx,js,jsx}\" --quiet --fix",
"lint:fix": "eslint \"app/{components,utilities}/**/*.{ts,tsx,js,jsx}\" --quiet --fix",
"typecheck": "tsc --noEmit",
"tsc": "tsc"
},
Expand All @@ -16,7 +16,7 @@
"@tailwindcss/container-queries": "^0.1.1",
"cnbuilder": "^3.1.0",
"flubber": "^0.4.2",
"framer-motion": "^11.9.0",
"framer-motion": "^11.11.9",
"next": "14.2.14",
"react": "^18",
"react-dom": "^18"
Expand Down
Binary file added public/assets/images/Hawa-Racine-Thiam.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/images/centennial-shape-a.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ export default {
],
theme: {
extend: {
colors: {
'soe-black': '#181818',
},
backgroundImage: {
'soe-red-gradient': 'linear-gradient(90deg, #400000 0.19%, #7A0000 52.26%, #400000 99.94%)',
'feature-gradient-bt': 'linear-gradient(180deg, rgba(0, 0, 0, 0.00) 75.5%, #181818 100%)',
'feature-gradient-rl': 'linear-gradient(270deg, rgba(23, 23, 26, 0.00) 0.11%, #181818 99.89%)',
},
fontFamily: {
'dm-sans': ['var(--font-dm-sans)', 'sans-serif'],
stanford: ['var(--font-stanford)', 'sans-serif'],
},
},
},
plugins: [
require('@tailwindcss/container-queries'),
require("@xpd/tailwind-3dtransforms")
require('@xpd/tailwind-3dtransforms'),
],
} satisfies Config;
Loading