Repository navigation
Add missing section to landing page #9960
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cb68484
Add missing section to landing page
PascalSenn dd07a27
fix
PascalSenn 0a76c7f
Potential fix for pull request finding
PascalSenn 3a5ef77
Potential fix for pull request finding
PascalSenn d806664
fix
PascalSenn e21dba1
Merge remote-tracking branch 'origin/main' into pse/complete-landing-…
tobias-tengler 355c594
Refinements
tobias-tengler 8251af5
Fix FusionFlow on mobile
tobias-tengler f28c389
Minor fixes
tobias-tengler e61d40b
Fixes
tobias-tengler a1ec91d
Fix useId not working in Satori image build
tobias-tengler fa77b81
Guard against font aliasing noise
tobias-tengler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,67 @@ | ||
| "use client"; | ||
|
|
||
| import type { ReactNode } from "react"; | ||
| import { useLayoutEffect, useRef, useState } from "react"; | ||
|
|
||
| interface RevealOnScrollProps { | ||
| readonly children: ReactNode; | ||
| readonly className?: string; | ||
| readonly hiddenClassName?: string; | ||
| readonly shownClassName?: string; | ||
| readonly rootMargin?: string; | ||
| readonly threshold?: number; | ||
| } | ||
|
|
||
| const DEFAULT_HIDDEN_CLASS_NAME = "translate-y-6 opacity-0"; | ||
| const DEFAULT_SHOWN_CLASS_NAME = "translate-y-0 opacity-100"; | ||
| const DEFAULT_TRANSITION_CLASS_NAME = "transition-all duration-700 ease-out"; | ||
|
|
||
| /** Reveals its content once when it first scrolls into view. */ | ||
| export function RevealOnScroll({ | ||
| children, | ||
| className, | ||
| hiddenClassName = DEFAULT_HIDDEN_CLASS_NAME, | ||
| shownClassName = DEFAULT_SHOWN_CLASS_NAME, | ||
| rootMargin = "0px 0px -10% 0px", | ||
| threshold = 0.2, | ||
| }: RevealOnScrollProps) { | ||
| const ref = useRef<HTMLDivElement>(null); | ||
| const [shown, setShown] = useState(false); | ||
|
|
||
| useLayoutEffect(() => { | ||
| const node = ref.current; | ||
| if (node === null) { | ||
| return; | ||
| } | ||
|
|
||
| // polyfill-free fallback for SSR and old browsers. The content will be visible | ||
| if (typeof IntersectionObserver === "undefined") { | ||
| const id = requestAnimationFrame(() => setShown(true)); | ||
| return () => cancelAnimationFrame(id); | ||
| } | ||
|
|
||
| const observer = new IntersectionObserver( | ||
| (entries) => { | ||
| for (const entry of entries) { | ||
| if (entry.isIntersecting) { | ||
| setShown(true); | ||
| observer.disconnect(); | ||
| } | ||
| } | ||
| }, | ||
| { threshold, rootMargin }, | ||
| ); | ||
|
|
||
| observer.observe(node); | ||
| return () => observer.disconnect(); | ||
| }, [rootMargin, threshold]); | ||
|
|
||
| return ( | ||
| <div | ||
| ref={ref} | ||
| className={`${className} ${DEFAULT_TRANSITION_CLASS_NAME} ${shown ? shownClassName : hiddenClassName}`} | ||
|
Copilot marked this conversation as resolved.
Resolved
|
||
| > | ||
| {children} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or 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 hidden or 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,78 @@ | ||
| import type { ComponentType, CSSProperties } from "react"; | ||
|
|
||
| type Drink = ComponentType<{ | ||
| readonly className?: string; | ||
| readonly style?: CSSProperties; | ||
| }>; | ||
|
|
||
| /** | ||
| * The drink icons are crops from one sprite: they share a bottom edge but have | ||
| * different viewBox heights (a coffee cup is 84 tall; the Strawberry Shake | ||
| * milkshake is 109; an espresso is 61). Sizing them all to one CSS height shrinks | ||
| * the taller drinks' bodies and floats them off the baseline. | ||
| * | ||
| * DrinkIcon renders every drink at a CONSTANT per-unit scale (so the cup bodies | ||
| * match) inside a fixed-height box, bottom-aligned, so a row reads as one shelf | ||
| * of drinks with consistent weight, a milkshake simply standing a little taller. | ||
| * | ||
| * `base` is the body height in px for a normal 84-unit cup; pass the px value the | ||
| * take used before (h-10 = 40, h-12 = 48, h-14 = 56, h-16 = 64). | ||
| */ | ||
|
|
||
| const COFFEE_CUP_UNITS = 84; | ||
|
|
||
| /** viewBox height per drink, used to keep one constant px-per-unit scale. */ | ||
| const DRINK_UNITS: Record<string, number> = { | ||
| "hot chocolate": 84, | ||
| fusion: 84, | ||
| nitro: 84, | ||
| mocha: 84, | ||
| "strawberry shake": 109, | ||
| "green donut": 109, | ||
| "cookie crumble": 109, | ||
| espresso: 61, | ||
| }; | ||
|
|
||
| /** Tallest drink we account for, so the box always reserves enough headroom. */ | ||
| const MAX_RATIO = 109 / COFFEE_CUP_UNITS; | ||
|
|
||
| function ratioFor(name: string): number { | ||
| const units = DRINK_UNITS[name.trim().toLowerCase()] ?? COFFEE_CUP_UNITS; | ||
| return units / COFFEE_CUP_UNITS; | ||
| } | ||
|
|
||
| interface DrinkIconProps { | ||
| readonly Icon: Drink; | ||
| /** Product name, used to look up the drink's true proportions. */ | ||
| readonly name: string; | ||
| /** Body height in px for a normal cup. */ | ||
| readonly base: number; | ||
| /** Applied to the inner svg (hover transforms, drop-shadow, etc.). */ | ||
| readonly className?: string; | ||
| readonly style?: CSSProperties; | ||
| } | ||
|
|
||
| export function DrinkIcon({ | ||
| Icon, | ||
| name, | ||
| base, | ||
| className, | ||
| style, | ||
| }: DrinkIconProps) { | ||
| return ( | ||
| <span | ||
| aria-hidden="true" | ||
| className="flex items-end justify-center" | ||
| style={{ height: `${base * MAX_RATIO}px` }} | ||
| > | ||
| <Icon | ||
| className={className} | ||
| style={{ | ||
| height: `${base * ratioFor(name)}px`, | ||
| width: "auto", | ||
| ...style, | ||
| }} | ||
| /> | ||
| </span> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.