Skip to content
Myr

client-file.tsx

This file

Path

apps/web/src/features/proposal/client-file.tsx

45 lines · 1.3 KiB · TypeScript

Last changed by

Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72

History of this file

Take it

Merge branch 'build/911-web-propose-and-proposal'oscabrielbefore adoptionbcb4cd9

line 1why, one step back
1/**

Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72

lines 2–3why, one step back
2 * `import.meta.env.SSR` is `true` in the Worker's build, so the dynamic import
3 * below is dead code there and the Worker bundles none of it.

Merge branch 'build/911-web-propose-and-proposal'oscabrielbefore adoptionbcb4cd9

lines 4–14why, one step back
4 */
5import { ClientOnly } from "@tanstack/react-router";6import { lazy, Suspense } from "react";78import type { DraftedFileProps } from "./drafted-file.tsx";910const DraftedFileLater = import.meta.env.SSR11 ? undefined12 : lazy(() => import("./drafted-file.tsx"));1314const Plain = ({ content }: { readonly content: string }) => (

Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e

line 15why, one step back
15 <pre className="border-rule bg-surface text-mono leading-code overflow-x-auto border px-3 py-2 font-mono">

Merge branch 'build/911-web-propose-and-proposal'oscabrielbefore adoptionbcb4cd9

lines 16–30why, one step back
16 {content}
17 </pre>18);1920export const DraftedCode = ({21 content,22 heading: Heading = "h3",23 path,24}: DraftedFileProps & {25 readonly heading?: "h3" | "h4";26}) => {27 const fallback = <Plain content={content} />;2829 return (30 <section className="flex min-w-0 flex-col gap-1.5" data-file={path}>

Merge build/1224-decider-pagesoscabrielbefore adoptiond22b7a2

line 31why, one step back
31 <Heading className="text-mono font-mono font-medium [overflow-wrap:anywhere]">

Merge branch 'build/911-web-propose-and-proposal'oscabrielbefore adoptionbcb4cd9

lines 32–45why, one step back
32 {path}
33 </Heading>34 {DraftedFileLater === undefined ? (35 fallback36 ) : (37 <ClientOnly fallback={fallback}>38 <Suspense fallback={fallback}>39 <DraftedFileLater content={content} path={path} />40 </Suspense>41 </ClientOnly>42 )}43 </section>44 );45};