diff --git a/app/Http/Controllers/DownloadController.php b/app/Http/Controllers/DownloadController.php index f08e589a..839270b3 100644 --- a/app/Http/Controllers/DownloadController.php +++ b/app/Http/Controllers/DownloadController.php @@ -10,7 +10,6 @@ use App\Support\Content\ContentRepository; use Carbon\CarbonImmutable; use Illuminate\Support\Facades\App; -use Illuminate\Support\Facades\File; use Inertia\Inertia; use Inertia\Response; @@ -18,8 +17,7 @@ // once platforms.json says it is released, the same way an unreleased iPhone app sends null. class DownloadController extends Controller { - // Which install method a package format belongs to, so a file row can name its distribution. - private const PACKAGE_METHOD = ['deb' => 'ppa', 'rpm' => 'copr', 'flatpak' => 'flatpak']; + private const LINUX_METHODS = ['ppa', 'copr', 'flatpak']; public function __invoke( ContentRepository $content, @@ -30,19 +28,17 @@ public function __invoke( ): Response { $locale = App::getLocale(); $release = $releases->latest(); - $floor = $platforms->macFloorVersion(); - $linux = $platforms->isReleased('linux') ? $this->linux($platforms, $linuxReleases->latest(), $locale) : null; return Inertia::render('Download', [ 'content' => $content->page('download', $locale), - 'release' => $release->toProps($locale), + 'release' => [...$release->toProps($locale), 'shortVersion' => $this->shortVersion($release->version)], 'mac' => [ ...($platforms->summary('mac') ?? ['deviceNames' => [], 'requirements' => null]), + 'universal' => ($platforms->find('mac')['universalBinary'] ?? false) === true, 'homebrewCommand' => $this->string($platforms->destination('mac', 'homebrew')['command'] ?? null), - 'homebrewTrails' => $floor !== null && $release->version !== null && version_compare($floor, $release->version, '<'), ], 'ios' => $this->ios($platforms, $facts, $locale), - 'linux' => $linux, + 'linux' => $platforms->isReleased('linux') ? $this->linux($platforms, $linuxReleases->latest(), $locale) : null, 'unreleased' => $platforms->unreleased(), 'links' => $this->links($facts), 'featuredEngines' => $facts->featuredEngineNames(), @@ -50,7 +46,7 @@ public function __invoke( } /** - * @return array{deviceNames: list, requirements: array{systems: list, minVersion: string, displayVersion: string, releaseName: string|null}, appStoreUrl: string|null, free: bool, inAppPurchases: bool, version: string|null, publishedAtFormatted: string|null}|null + * @return array{deviceNames: list, requirements: array{systems: list, minVersion: string, displayVersion: string, releaseName: string|null}, appStoreUrl: string|null, free: bool, inAppPurchases: bool, version: string|null, shortVersion: string|null, publishedAtFormatted: string|null}|null */ private function ios(PlatformCatalog $platforms, SiteFacts $facts, string $locale): ?array { @@ -63,77 +59,45 @@ private function ios(PlatformCatalog $platforms, SiteFacts $facts, string $local $platform = $platforms->find('ios') ?? []; $price = is_array($platform['price'] ?? null) ? $platform['price'] : []; $release = is_array($platform['release'] ?? null) ? $platform['release'] : []; + $version = $this->string($release['version'] ?? null); return [ ...$summary, 'appStoreUrl' => $this->url($platforms->destination('ios', 'app-store')['url'] ?? null) ?? $facts->links()['appStore'], 'free' => is_numeric($price['amount'] ?? null) && (float) $price['amount'] === 0.0, 'inAppPurchases' => ($price['inAppPurchases'] ?? false) === true, - 'version' => $this->string($release['version'] ?? null), + 'version' => $version, + 'shortVersion' => $this->shortVersion($version), 'publishedAtFormatted' => $this->date($release['publishedAt'] ?? null, $locale), ]; } /** - * @return array{deviceNames: list, channel: string, distributions: list, via: string}>, desktop: array{name: string, version: string}|null, architectures: list, methods: list, update: string|null}>, packages: list}>, checksums: array{name: string, url: string|null}|null, verify: string|null, release: array{version: string, publishedOn: string|null, releaseUrl: string, releasesUrl: string}|null} + * @return array{deviceNames: list, channel: string, distributions: list, via: string}>, architectures: list, methods: list}>, release: array{version: string, shortVersion: string, publishedOn: string|null, releaseUrl: string, releasesUrl: string}|null} */ private function linux(PlatformCatalog $platforms, ?LinuxRelease $release, string $locale): array { $platform = $platforms->find('linux') ?? []; $summary = $platforms->linuxSummary() ?? ['deviceNames' => [], 'channel' => $platforms->linuxChannel(), 'distributions' => []]; - $packages = $platforms->linuxPackages(); - $architectures = $this->strings($platform['architectures'] ?? []); - $desktop = $platform['desktop'] ?? null; - $distributions = $summary['distributions']; - $methods = []; foreach (is_array($platform['destinations'] ?? null) ? $platform['destinations'] : [] as $destination) { $commands = $this->strings(is_array($destination) ? ($destination['commands'] ?? []) : []); - if ($commands !== [] && in_array($destination['kind'] ?? null, self::PACKAGE_METHOD, true)) { - $methods[] = ['kind' => $destination['kind'], 'commands' => $commands, 'update' => $this->string($destination['update'] ?? null)]; - } - } - - $byName = []; - - foreach ($release?->assets ?? [] as $asset) { - $byName[$asset['name']] = ['name' => $asset['name'], 'url' => $asset['url'], 'bytes' => $asset['bytes']]; - } - - $rows = []; - - foreach ($release !== null ? ($packages['assets'] ?? []) : [] as $asset) { - $via = self::PACKAGE_METHOD[$asset['format']] ?? null; - $named = collect($distributions)->first(fn(array $distribution): bool => $distribution['via'] === $via && $distribution['name'] !== null); - - foreach ($asset['series'] === [] ? [null] : $asset['series'] as $series) { - $files = []; - - foreach ($architectures as $architecture) { - $name = strtr($asset['template'], ['{version}' => $release->version, '{series}' => (string) $series, '{arch}' => $asset['arch'][$architecture] ?? $architecture]); - $files[$architecture] = $byName[$name] ?? null; - } - - if (array_filter($files) !== []) { - $rows[] = ['format' => $asset['format'], 'series' => $series, 'distribution' => $named['name'] ?? null, 'files' => $files]; - } + if ($commands !== [] && in_array($destination['kind'] ?? null, self::LINUX_METHODS, true)) { + $methods[] = ['kind' => $destination['kind'], 'commands' => $commands]; } } return [ 'deviceNames' => $summary['deviceNames'], 'channel' => $summary['channel'], - 'distributions' => $distributions, - 'desktop' => is_array($desktop) && is_string($desktop['name'] ?? null) && is_string($desktop['version'] ?? null) ? ['name' => $desktop['name'], 'version' => $desktop['version']] : null, - 'architectures' => $architectures, + 'distributions' => $summary['distributions'], + 'architectures' => $this->strings($platform['architectures'] ?? []), 'methods' => $methods, - 'packages' => $rows, - 'checksums' => $packages !== null && is_string($packages['checksums'] ?? null) ? ['name' => $packages['checksums'], 'url' => $release?->checksumsUrl] : null, - 'verify' => $this->string($packages['verify'] ?? null), 'release' => $release === null ? null : [ 'version' => $release->version, + 'shortVersion' => $this->shortVersion($release->version) ?? $release->version, 'publishedOn' => $this->date($release->publishedAt, $locale), 'releaseUrl' => $release->releaseUrl, 'releasesUrl' => $release->releasesUrl, @@ -142,21 +106,29 @@ private function linux(PlatformCatalog $platforms, ?LinuxRelease $release, strin } /** - * @return array{docs: string|null, changelog: string|null, source: string|null, license: string|null, issues: string|null} + * @return array{changelog: string|null, source: string|null, license: string|null} */ private function links(SiteFacts $facts): array { $links = $facts->links(); return [ - 'docs' => $links['docs'], 'changelog' => $links['changelog'] ?? ($links['docs'] !== null ? rtrim($links['docs'], '/') . '/changelog' : null), 'source' => $links['github'] ?? 'https://github.com/' . config('services.github.repo'), 'license' => $links['license'], - 'issues' => $links['issues'], ]; } + // The page's H1 names a release by major and minor, as Zed does: 0.85.0 is "0.85", 0.1.0-beta.3 is "0.1". + private function shortVersion(?string $version): ?string + { + if ($version === null || preg_match('/^(\d+)\.(\d+)/', $version, $parts) !== 1) { + return $version; + } + + return "{$parts[1]}.{$parts[2]}"; + } + private function date(mixed $date, string $locale): ?string { if (! is_string($date) || preg_match('/^\d{4}-\d{2}-\d{2}$/', $date) !== 1) { diff --git a/docs/rebuild/design/architecture.md b/docs/rebuild/design/architecture.md index 8fec13e1..68e6763e 100644 --- a/docs/rebuild/design/architecture.md +++ b/docs/rebuild/design/architecture.md @@ -1084,19 +1084,18 @@ the appcast top item, `formulae.brew.sh/api/cask/tablepro.json` and the iTunes l non-zero on a mismatch. It is never scheduled. It runs at final verification because spec §0 says to re-check the release state. Its tests use `Http::fake`. -**Client** (`resources/js/pages/Download.tsx`, rewritten). The pure logic lives in `resources/js/lib/device.ts`, which -`node --test` can load: +**Client** (`resources/js/pages/Download.tsx`, rebuilt 2026-11-08). The pure logic lives in `resources/js/lib/device.ts`, +which `node --test` can load: | Function | Rule | |---|---| -| `classifyDevice(ua, maxTouchPoints)` | `ios` when `/iPhone\|iPad\|iPod/` matches, or when `Macintosh` matches and `maxTouchPoints > 1` (iPadOS desktop UA). `mac` when `Macintosh` matches. `other` for Android and ChromeOS, `linux` for any other `Linux` or `X11`. Otherwise `other`. **An iPhone UA ("like Mac OS X") is never `mac`**. The root template's head script repeats the `ios` and `linux` rules as classes, before first paint (`tests/js/device.test.ts` runs it against this function) | - -**Behaviour.** SSR renders one panel per released platform with real URLs from the server props (the DMG, the App -Store, the Linux commands and files) and shows the Mac panel. Before paint, the head script's `ios` or `linux` class -shows that platform's panel instead; after mount `classifyDevice()` keeps the same choice, or the one a `#mac`, `#ios` -or `#linux` link names (design-system §8.7). **Nothing starts on its own**, and no copy says a download is starting. -After a click the page may say "If the download didn't begin, use this link". `trackDownload(location, platform)` takes -`mac`, `ios` or `linux`. No Windows button appears. +| `classifyDevice(ua, maxTouchPoints)` | `ios` when `/iPhone\|iPad\|iPod/` matches, or when `Macintosh` matches and `maxTouchPoints > 1` (iPadOS desktop UA). `mac` when `Macintosh` matches. `other` for Android and ChromeOS, `linux` for any other `Linux` or `X11`. Otherwise `other`. **An iPhone UA ("like Mac OS X") is never `mac`**. The root template's head script repeats the rules as `ios`, `linux` and `other-device` classes, before first paint (`tests/js/device.test.ts` runs it against this function) | + +**Behaviour.** SSR renders the hero's variant for every machine and a band per released platform, with real URLs from +the server props (the DMG, Homebrew, the Linux commands, the App Store). The head script's class picks the hero's +variant before paint (design-system §8.7); no script chooses after it. **Nothing starts on its own.** After a click on +the DMG link the action gives way to "Your download has started", the same link and three install steps. +`trackDownload(location, platform)` takes `mac`, `ios` or `linux`. No Windows button appears. ### 1.14 Forms and cross-app contracts diff --git a/docs/rebuild/design/design-system.md b/docs/rebuild/design/design-system.md index 9f1d156f..34e04499 100644 --- a/docs/rebuild/design/design-system.md +++ b/docs/rebuild/design/design-system.md @@ -212,7 +212,6 @@ The page sketches in §8 add layout to the sitemap's structure. Where a sketch a - One primary (accent) button per view region. - Allowed exceptions: - - Download: the arch pair, where one is primary and one secondary. - Pricing: no button is primary (§5.3.18). **Never:** @@ -506,7 +505,6 @@ Decided by the owner on 2026-10-06, after a rendered survey of grid-line sites ( - the homepage: the hero's two download actions, the featured engines, the sponsors, the workflow rows (from 1280px each sets its text in 4 columns beside its capture in 8, so one divider runs down the section; a detail row is two cells, 5 / 7 from 1024), the safety row, the platform block, the plans and the closing actions - `/pricing`: the plans (`PricingPlans` is the same component) -- `/download`: the release row Prose sections (`#ai`, `#switch`, articles) stay unlined inside their joins. Cards stay cards where a block holds a single object (the database facts card, callouts, code blocks, account panels). @@ -515,7 +513,7 @@ Prose sections (`#ai`, `#switch`, articles) stay unlined inside their joins. Car - `frame-table` on a DataTable's scroll region: the region reaches the rails, the first and last cells pad their text back to the content edges (the first column's text now starts on the heading edge), and the header row has one rule, not the 2px of its own rule plus the first row's. - `frame-rows` on a ruled list in a wide section, and `frame-rows-text` on one at the reading measure: the list reaches the rails from whatever measure it sits in, using container units (`Section`'s Container is a size container), and each row keeps its text at the measure. Used by DescriptionList rows, FaqList items, PostList rows and the feature and comparison lists. - `cell-rows` on a ruled list inside a cell, and the same bleed on a single divider in a cell (a plan's "Includes", the Mac card's "Other ways to install"): wall to wall. -- Topics within one subject are blocks of their own, so the frame's joins separate them: `/pricing`'s license, billing, refunds, Team, open source and FAQ, `/download`'s release row, and a blog post's related posts. +- Topics within one subject are blocks of their own, so the frame's joins separate them: `/pricing`'s license, billing, refunds, Team, open source and FAQ, `/download`'s platforms, and a blog post's related posts. - A list that opens a block starts on its join (the blog index), and a list inside a card keeps its own inset rules, closed by the card's edge. `PageFrameTest` fails any `dl`, ruled list or table in `
` that does none of these, outside a card or a blog article's own prose. @@ -640,7 +638,7 @@ Repo key: - `fullWidth` stretches the button in cards and on mobile. - Labels never truncate, and wrap to two centred lines at most. - Filled variants keep a transparent 1px border so they stay outlined in forced-colours mode. -- Render `` when the button navigates and ` + {caption !== undefined &&

{caption}

} + + ); +} diff --git a/resources/js/components/download/mac-panel.tsx b/resources/js/components/download/mac-panel.tsx deleted file mode 100644 index eceb69e4..00000000 --- a/resources/js/components/download/mac-panel.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import { useState } from 'react'; -import { Download } from 'lucide-react'; -import Button from '@/components/ui/button'; -import Callout from '@/components/ui/callout'; -import { CodeBlock, InlineCode } from '@/components/ui/code'; -import Disclosure from '@/components/ui/disclosure'; -import { textLinkClasses } from '@/components/ui/text-link'; -import { Trans, useI18n } from '@/i18n'; -import { keepTogether } from '@/i18n/format'; -import { trackDownload } from '@/lib/analytics'; -import { architecturesText } from '@/lib/data/platforms'; -import { megabytes, requirementLine } from './format'; -import PanelFacts, { CENTRED_DISCLOSURE } from './panel-facts'; -import type { DownloadContent, MacProp, ReleaseProp } from './types'; - -const UI_TAGS = { ui: (text: string) => {text} }; - -interface MacPanelProps { - content: DownloadContent; - release: ReleaseProp; - mac: MacProp; -} - -// The DMG link is in the server render with its real URL, and nothing claims a download started: the install hint -// appears only after the reader clicked, and offers the same file again in case nothing arrived. -export default function MacPanel({ content, release, mac }: MacPanelProps) { - const { m, fmt } = useI18n(); - const [clicked, setClicked] = useState(false); - - const available = release.source !== 'unavailable'; - const { asset } = release; - const version = - available && release.version !== null - ? release.publishedAtFormatted !== null - ? fmt(m.download.release.dated, { version: release.version, date: keepTogether(release.publishedAtFormatted) }) - : fmt(m.download.release.undated, { version: release.version }) - : null; - - return ( -
- - - {(mac.homebrewCommand !== null || asset.sha256 !== null) && ( -
- {mac.homebrewCommand !== null && ( -
-

{content.mac.homebrew.title}

- - {mac.homebrewTrails && ( -

- -

- )} -
- )} - - {asset.name !== null && asset.sha256 !== null && ( - -

{content.mac.signing}

-

- {text} }} /> -

-

- {asset.name} - {asset.sha256} -

-
- )} -
- )} -
- ); -} diff --git a/resources/js/components/download/panel-facts.tsx b/resources/js/components/download/panel-facts.tsx deleted file mode 100644 index 9b0f7a31..00000000 --- a/resources/js/components/download/panel-facts.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import type { ReactNode } from 'react'; -import DotList from '@/components/ui/dot-list'; - -// A disclosure under the centred facts: its summary centred, what it opens left-aligned at full width. -export const CENTRED_DISCLOSURE = 'text-center [&>div]:pl-0 [&>div]:text-left'; - -interface PanelFactsProps { - action: ReactNode; - // Each line is one DotList: version and size, then requirement and architecture. - lines: ReactNode[][]; - updates: string; - children?: ReactNode; -} - -// The centred top of a platform panel: the one action, its facts in two short lines, and how it updates. -export default function PanelFacts({ action, lines, updates, children }: PanelFactsProps) { - return ( -
- {action} -
- {lines.map((items, index) => ( - - ))} -
-

{updates}

- {children} -
- ); -} diff --git a/resources/js/components/download/platform-switch.tsx b/resources/js/components/download/platform-switch.tsx deleted file mode 100644 index f55a9113..00000000 --- a/resources/js/components/download/platform-switch.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'; -import SegmentedControl from '@/components/ui/segmented-control'; -import { classifyDevice } from '@/lib/device'; -import { cn } from '@/lib/utils'; -import type { PlatformKey } from './types'; - -export interface PlatformTab { - key: PlatformKey; - // The accessible heading of the panel, and the segment's text. - name: string; - label: ReactNode; - icon: ReactNode; - panel: ReactNode; -} - -interface PlatformSwitchProps { - legend: string; - tabs: PlatformTab[]; -} - -function fromHash(keys: PlatformKey[]): PlatformKey | null { - return keys.find((key) => window.location.hash === `#${key}`) ?? null; -} - -// One panel at a time. The server renders the first platform; before paint, a root `ios` or `linux` class from the head -// script shows that platform instead (app.css), and the layout effect then takes over without a visible swap. A link to -// `#mac`, `#ios` or `#linux` opens that panel, and a choice is kept in the URL so a reload or a shared link keeps it. -// The browser scrolls to a linked panel after the layout effect, so a panel's scroll margin clears the switch above it -// and both land the switch under the header. -export default function PlatformSwitch({ legend, tabs }: PlatformSwitchProps) { - const root = useRef(null); - const keys = tabs.map((tab) => tab.key); - const [chosen, setChosen] = useState(null); - - useLayoutEffect(() => { - const linked = fromHash(keys); - const device = classifyDevice(navigator.userAgent, navigator.maxTouchPoints ?? 0); - - setChosen(linked ?? keys.find((key) => key === device) ?? keys[0]); - - if (linked !== null) { - root.current?.scrollIntoView({ block: 'start' }); - } - }, []); - - useEffect(() => { - const follow = (): void => { - const linked = fromHash(keys); - - if (linked !== null) { - setChosen(linked); - root.current?.scrollIntoView({ block: 'start' }); - } - }; - - window.addEventListener('hashchange', follow); - - return () => window.removeEventListener('hashchange', follow); - }, []); - - const shown = chosen ?? keys[0]; - - return ( -
- - legend={legend} - name="platform" - size="lg" - value={shown} - options={tabs.map((tab) => ({ value: tab.key, label: tab.label, icon: tab.icon }))} - onChange={(next) => { - setChosen(next); - window.history.replaceState(window.history.state, '', `#${next}`); - }} - /> - - {tabs.map((tab) => ( -
-

- {tab.name} -

- {tab.panel} -
- ))} -
- ); -} diff --git a/resources/js/components/download/qr-code.tsx b/resources/js/components/download/qr-code.tsx new file mode 100644 index 00000000..8a508602 --- /dev/null +++ b/resources/js/components/download/qr-code.tsx @@ -0,0 +1,21 @@ +import { useMemo } from 'react'; +import { qrMatrix, qrPath } from '@/lib/qr'; +import { cn } from '@/lib/utils'; + +const QUIET_ZONE = 4; + +// Black on white in both themes: a phone camera reads dark modules on a light ground, and the quiet zone is part of it. +export default function QrCode({ value, className }: { value: string; className?: string }) { + const { path, size } = useMemo(() => { + const matrix = qrMatrix(value); + + return { path: qrPath(matrix, QUIET_ZONE), size: matrix.length + QUIET_ZONE * 2 }; + }, [value]); + + return ( + + ); +} diff --git a/resources/js/components/download/types.ts b/resources/js/components/download/types.ts index 41a04389..68cf783a 100644 --- a/resources/js/components/download/types.ts +++ b/resources/js/components/download/types.ts @@ -10,13 +10,14 @@ export interface ReleaseAsset { name: string | null; // GitHub's latest-release page when no release source answered. url: string; - // The Sparkle appcast has no sizes or digests, only the GitHub API does. bytes: number | null; sha256: string | null; } export interface ReleaseProp { version: string | null; + // "0.85" for 0.85.0, the H1's version. + shortVersion: string | null; publishedAt: string | null; // Formatted in PHP, so SSR and the browser agree. publishedAtFormatted: string | null; @@ -29,9 +30,9 @@ export interface ReleaseProp { export interface MacProp { deviceNames: string[]; requirements: Requirements | null; + // One DMG for Apple silicon and Intel. + universal: boolean; homebrewCommand: string | null; - // The Homebrew cask still serves an older version than this release. - homebrewTrails: boolean; } export interface IosProp { @@ -41,6 +42,7 @@ export interface IosProp { free: boolean; inAppPurchases: boolean; version: string | null; + shortVersion: string | null; publishedAtFormatted: string | null; } @@ -56,49 +58,28 @@ export interface LinuxDistributionProp { export interface LinuxMethod { kind: LinuxMethodKind; commands: string[]; - update: string | null; -} - -export interface LinuxFile { - name: string; - url: string; - bytes: number | null; -} - -export interface LinuxPackageRow { - format: 'deb' | 'rpm' | 'flatpak'; - series: string | null; - distribution: string | null; - // Keyed by the architecture as platforms.json names it; null where the release has no such file. - files: Record; } export interface LinuxProp { deviceNames: string[]; channel: 'beta' | 'stable'; distributions: LinuxDistributionProp[]; - desktop: { name: string; version: string } | null; architectures: string[]; methods: LinuxMethod[]; - packages: LinuxPackageRow[]; - checksums: { name: string; url: string | null } | null; - // `{file}` stands for the downloaded file. - verify: string | null; - release: { version: string; publishedOn: string | null; releaseUrl: string; releasesUrl: string } | null; + release: { version: string; shortVersion: string; publishedOn: string | null; releaseUrl: string; releasesUrl: string } | null; } // What a page outside /download says about Linux: `PlatformCatalog::linuxSummary`, null until Linux is released. export type LinuxSummary = Pick; export interface LinksProp { - docs: string | null; changelog: string | null; source: string | null; license: string | null; - issues: string | null; } -export type PlatformKey = 'mac' | 'linux' | 'ios'; +// What the head script in app.blade.php calls the reader's machine; a Mac carries no class. +export type DeviceKey = 'mac' | 'linux' | 'ios' | 'other'; export interface DownloadPageProps { content: DownloadContent; diff --git a/resources/js/components/features/feature-band.tsx b/resources/js/components/features/feature-band.tsx index d3458ee0..57409709 100644 --- a/resources/js/components/features/feature-band.tsx +++ b/resources/js/components/features/feature-band.tsx @@ -40,7 +40,7 @@ export function BandFrame({ id, also, title, marker, asset, assetClassName, besi {marker} -
{children}
+
{children}
{beside !== undefined &&
{beside}
} {after !== undefined &&
{after}
} diff --git a/resources/js/components/features/feature-hero.tsx b/resources/js/components/features/feature-hero.tsx index 763127af..8034b581 100644 --- a/resources/js/components/features/feature-hero.tsx +++ b/resources/js/components/features/feature-hero.tsx @@ -10,7 +10,7 @@ import { cn } from '@/lib/utils'; import { docsHref } from './model'; interface FeatureHeroProps { - title: string; + title: ReactNode; lead: ReactNode; // A docs.tablepro.app path; the hub links the docs home. docs?: string; diff --git a/resources/js/components/ui/code.tsx b/resources/js/components/ui/code.tsx index 56ec9421..aca30a5a 100644 --- a/resources/js/components/ui/code.tsx +++ b/resources/js/components/ui/code.tsx @@ -29,6 +29,8 @@ interface CodeBlockProps { command?: boolean; // Without them there is no copy button. copyLabels?: CopyButtonLabels; + // `md` writes "Copy" and "Copied" beside the icon. + copySize?: 'sm' | 'md'; // What to copy when `code` is not given. copyValue?: string; onCopied?: () => void; @@ -37,9 +39,9 @@ interface CodeBlockProps { } // A line wider than the column scrolls inside the block, from the keyboard too, instead of widening the page. -export function CodeBlock({ label, title, code, command = false, copyLabels, copyValue, onCopied, className, children }: CodeBlockProps) { +export function CodeBlock({ label, title, code, command = false, copyLabels, copySize, copyValue, onCopied, className, children }: CodeBlockProps) { const value = code ?? copyValue; - const copy = copyLabels && value !== undefined ? : null; + const copy = copyLabels && value !== undefined ? : null; return (
diff --git a/resources/js/components/ui/copy-button.tsx b/resources/js/components/ui/copy-button.tsx index 897ea6a5..c941a705 100644 --- a/resources/js/components/ui/copy-button.tsx +++ b/resources/js/components/ui/copy-button.tsx @@ -75,7 +75,7 @@ export default function CopyButton({ value, label, size = 'sm', labels = ENGLISH )} > {copied ? ( -