Change side-by-side sections to sticky (#2445)
This commit is contained in:
@@ -8,7 +8,7 @@ export function CodeWindow(props: CodeWindowProps) {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
class={`rounded-lg bg-slate-700 overflow-hidden w-full max-w-full [&>*]:rounded-t-none ${
|
||||
class={`-mx-4 sm:mx-0 w-[calc(100%+2rem)] sm:w-full sm:rounded-lg bg-slate-700 overflow-hidden sm:max-w-full [&>*]:rounded-t-none ${
|
||||
props.class ?? ""
|
||||
}`}
|
||||
style={props.style}
|
||||
|
||||
@@ -3,7 +3,8 @@ import { JSX } from "preact";
|
||||
export function PageSection(props: JSX.HTMLAttributes<HTMLDivElement>) {
|
||||
return (
|
||||
<section
|
||||
class={`w-full max-w-screen-xl mx-auto my-8 sm:my-16 md:my-24 lg:my-32 px-4 sm:px-8 lg:px-16 2xl:px-0 flex flex-col gap-8 md:gap-16 ${
|
||||
id={props.id ?? ""}
|
||||
class={`w-full max-w-screen-xl mx-auto my-16 md:my-24 lg:my-32 px-4 sm:px-8 lg:px-16 2xl:px-0 flex flex-col gap-8 md:gap-16 ${
|
||||
props.class ?? ""
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -24,11 +24,9 @@ export function SideBySide(props: SideBySideProps) {
|
||||
lgSplitClass = "lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]";
|
||||
}
|
||||
|
||||
const swapClass = props.reverseOnDesktop ? "swap-on-mobile" : "";
|
||||
|
||||
return (
|
||||
<div
|
||||
class={`grid grid-cols-1 items-center gap-8 md:gap-16 xl:gap-32 ${
|
||||
class={`grid grid-cols-1 items-center gap-12 md:gap-16 xl:gap-32 ${
|
||||
props.reverseOnDesktop ? "md:first:[&>*]:order-1" : ""
|
||||
} ${mdSplitClass} ${lgSplitClass} ${props.class ?? ""}`}
|
||||
>
|
||||
|
||||
@@ -3,19 +3,16 @@ import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
|
||||
|
||||
export function CTA() {
|
||||
return (
|
||||
<div
|
||||
class="bg-gradient-to-br from-blue-100 via-green-200 to-yellow-100 pb-32"
|
||||
style="clip-path: polygon(0% 10%, 0% 100%, 100% 100%, 100% 0%)"
|
||||
>
|
||||
<PageSection class="text-center">
|
||||
<div class="relative mt-16">
|
||||
<PageSection class="text-center bg-gradient-to-br from-blue-100 via-green-200 to-yellow-100 pb-32 md:pb-48 before:w-full before:bg-white before:h-16 md:before:h-32 xl:before:h-48 before:[clip-path:polygon(0%_0%,_100%_0%,_0%_100%)] z-0 before:absolute before:top-0 before:left-0">
|
||||
<div class="flex flex-col gap-4">
|
||||
<img
|
||||
src="/lemon.svg"
|
||||
alt="Illustration of a lemon sliced cleanly in half, suspended in midair as though frozen in time the instant after the cut, the juice flung from the edges"
|
||||
class="w-full max-w-64 mx-auto mb-8"
|
||||
class="w-full max-w-48 sm:max-w-64 -mt-24 mx-auto mb-8 relative z-0"
|
||||
/>
|
||||
<h2 class="text-3xl sm:text-4xl md:text-5xl lg:text-6xl text-gray-600 font-extrabold">
|
||||
Time for a Fresh Start
|
||||
Time for a Fresh start
|
||||
</h2>
|
||||
<div class="flex flex-col justify-start items-center gap-4">
|
||||
<p class="text-xl">
|
||||
|
||||
@@ -6,19 +6,19 @@ import { SectionHeading } from "$fresh/www/components/homepage/SectionHeading.ts
|
||||
import { DemoBox } from "$fresh/www/components/homepage/DemoBox.tsx";
|
||||
import { ExampleArrow } from "$fresh/www/components/homepage/ExampleArrow.tsx";
|
||||
import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
|
||||
import { FormSubmitDemo } from "../../islands/FormSubmitDemo.tsx";
|
||||
|
||||
const routingCode = `import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
async POST(req, ctx) {
|
||||
async POST(req) {
|
||||
const form = await req.formData();
|
||||
const email = form.get("email")?.toString();
|
||||
|
||||
// Save email to database here
|
||||
// Do something with the form data here,
|
||||
// then redirect user to thank you page
|
||||
|
||||
// Redirect user to thank you page.
|
||||
const headers = new Headers();
|
||||
headers.set("location", "/thanks-for-subscribing");
|
||||
headers.set("location", "/thanks");
|
||||
return new Response(null, {
|
||||
status: 303,
|
||||
headers,
|
||||
@@ -28,9 +28,9 @@ export const handler: Handlers = {
|
||||
|
||||
export function FormsSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide mdColSplit="2/3" lgColSplit="2/3">
|
||||
<div class="flex flex-col gap-4">
|
||||
<PageSection id="forms-section">
|
||||
<SideBySide mdColSplit="2/3" lgColSplit="2/3" class="!items-start">
|
||||
<div class="flex flex-col gap-4 md:sticky md:top-4">
|
||||
<div
|
||||
role="img"
|
||||
alt="Arrows routing and crossing each other emoji"
|
||||
@@ -59,7 +59,7 @@ export function FormsSection() {
|
||||
</SectionHeading>
|
||||
<p>
|
||||
Don't fight the browser. Fresh helps you handle form submissions and
|
||||
other dynamic requests server-side, simply and easily.
|
||||
other dynamic requests server-side, from any route.
|
||||
</p>
|
||||
<p>
|
||||
Since Fresh is built on{" "}
|
||||
@@ -77,14 +77,10 @@ export function FormsSection() {
|
||||
lang="jsx"
|
||||
/>
|
||||
</CodeWindow>
|
||||
{
|
||||
/* <ExampleArrow />
|
||||
<ExampleArrow />
|
||||
<DemoBox>
|
||||
<p>
|
||||
TODO: something goes here.
|
||||
</p>
|
||||
</DemoBox> */
|
||||
}
|
||||
<FormSubmitDemo />
|
||||
</DemoBox>
|
||||
</div>
|
||||
</SideBySide>
|
||||
</PageSection>
|
||||
|
||||
@@ -11,7 +11,7 @@ export function Hero(props: { origin: string }) {
|
||||
<div class="bg-green-300 mt-0 pt-32 md:pt-48 !mb-0 bg-gradient-to-br from-blue-100 via-green-200 to-yellow-100">
|
||||
<div class="md:grid grid-cols-5 gap-8 md:gap-16 items-center w-full max-w-screen-xl mx-auto px-4 md:px-8 lg:px-16 2xl:px-0">
|
||||
<div class="flex-1 text-center md:text-left md:col-span-3 pb-8 md:pb-32">
|
||||
<h2 class="text-4xl sm:text-5xl lg:text-6xl sm:tracking-tight sm:leading-none! font-extrabold">
|
||||
<h2 class="text-[calc(1rem+4vw)] leading-tight sm:text-5xl lg:text-6xl sm:tracking-tight sm:leading-none! font-extrabold">
|
||||
The simple, approachable, productive web framework
|
||||
</h2>
|
||||
<div class="mt-12 flex flex-wrap justify-center items-stretch md:justify-start gap-4">
|
||||
|
||||
@@ -29,8 +29,13 @@ export default function Counter(props) {
|
||||
export function IslandsSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide mdColSplit="3/2" lgColSplit="3/2" reverseOnDesktop={true}>
|
||||
<div class="flex flex-col gap-4">
|
||||
<SideBySide
|
||||
mdColSplit="3/2"
|
||||
lgColSplit="3/2"
|
||||
reverseOnDesktop={true}
|
||||
class="!items-start"
|
||||
>
|
||||
<div class="flex flex-col gap-4 md:sticky md:top-4">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="icon icon-tabler icon-tabler-beach text-fresh"
|
||||
@@ -56,9 +61,8 @@ export function IslandsSection() {
|
||||
JavaScript only where needed.
|
||||
</p>
|
||||
<p>
|
||||
Because it's{" "}
|
||||
<a href="https://preactjs.com/" class="underline">Preact</a>, you
|
||||
get best-in-class performance, plus the convenience of{" "}
|
||||
Because it's Preact, you get best-in-class performance, plus the
|
||||
convenience of{" "}
|
||||
<a href="https://preactjs.com/guide/v10/signals/" class="underline">
|
||||
Signals
|
||||
</a>.
|
||||
|
||||
@@ -35,8 +35,13 @@ export const Recipes = () => (
|
||||
export function PartialsSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide mdColSplit="3/2" lgColSplit="3/2" reverseOnDesktop={true}>
|
||||
<div class="flex flex-col gap-4">
|
||||
<SideBySide
|
||||
mdColSplit="3/2"
|
||||
lgColSplit="3/2"
|
||||
reverseOnDesktop={true}
|
||||
class="!items-start"
|
||||
>
|
||||
<div class="flex flex-col gap-4 md:sticky md:top-4">
|
||||
<svg
|
||||
role="img"
|
||||
alt="Arrows transferring data down "
|
||||
@@ -62,8 +67,8 @@ export function PartialsSection() {
|
||||
|
||||
<SectionHeading>Stream HTML straight from the server</SectionHeading>
|
||||
<p>
|
||||
Fresh Partials let you fetch HTML and update only the parts of the
|
||||
page that need to change, without reloading the entire page.
|
||||
Fresh Partials let you fetch HTML and slot it directly into the
|
||||
page, without a full page reload.
|
||||
</p>
|
||||
<FancyLink href="/docs/concepts/partials" class="mt-4">
|
||||
Learn more about Partials
|
||||
|
||||
@@ -16,8 +16,8 @@ const serverCode = `export default function HomePage() {
|
||||
export function RenderingSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide mdColSplit="2/3" lgColSplit="2/3">
|
||||
<div class="flex flex-col gap-4">
|
||||
<SideBySide mdColSplit="2/3" lgColSplit="2/3" class="!items-start">
|
||||
<div class="flex flex-col gap-4 md:sticky md:top-4">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="icon icon-tabler icon-tabler-atom text-fresh"
|
||||
@@ -41,8 +41,10 @@ export function RenderingSection() {
|
||||
Build fast apps fast
|
||||
</SectionHeading>
|
||||
<p>
|
||||
Fresh routes are dynamically server-rendered Preact components, so
|
||||
there's zero JavaScript shipped to the browser by default.
|
||||
Fresh routes are dynamically server-rendered{" "}
|
||||
<a href="https://preactjs.com/" class="underline">Preact</a>{" "}
|
||||
components, so there's zero JavaScript shipped to the browser by
|
||||
default.
|
||||
</p>
|
||||
<p>Simple to write; fast to run.</p>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
|
||||
export function Simple() {
|
||||
return (
|
||||
<PageSection class="!my-16">
|
||||
<PageSection class="!mb-12 !mt-20">
|
||||
<div class="text-center max-w-max mx-auto flex flex-col gap-4">
|
||||
<p class="italic text-gray-500 text-lg">Introducing Fresh:</p>
|
||||
<h2 class="text-4xl sm:text-5xl md:text-6xl lg:text-7xl sm:tracking-tight sm:leading-[1.1]! font-extrabold text-balance text-gray-600">
|
||||
|
||||
Reference in New Issue
Block a user