Skip to content
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
4 changes: 2 additions & 2 deletions components/site/Chrome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ export function Chrome() {
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src="/wordmark-light.svg"
alt="decdn_"
alt="decdn"
width={112}
height={30}
className={onDark ? "hidden" : "block"}
/>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src="/wordmark-dark.svg"
alt="decdn_"
alt="decdn"
width={112}
height={30}
className={onDark ? "block" : "hidden"}
Expand Down
23 changes: 14 additions & 9 deletions components/site/Close.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@ export function Close() {
Contact
</h2>

<div
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
data-reveal
className="hug flex items-baseline gap-2 font-semibold tracking-[-0.05em]"
style={{ fontSize: "var(--fs-display)", lineHeight: "0.86" }}
>
<span>decdn</span>
<span aria-hidden style={{ color: "var(--whisper)" }}>
_
</span>
</div>
src="/wordmark-light.svg"
alt="decdn"
width={411}
height={110}
className="block"
style={{
["--wordmark-h" as string]: "clamp(4.75rem, 14vw, 11.5rem)",
height: "var(--wordmark-h)",
width: "auto",
marginLeft: "calc(var(--wordmark-h) * -0.18)",
}}
Comment on lines +30 to +34

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Casting individual CSS variable keys with as string is a bit verbose. A cleaner approach in TypeScript is to cast the entire style object to React.CSSProperties, which allows for arbitrary property names starting with -- without needing individual casts for each key.

Suggested change
["--wordmark-h" as string]: "clamp(4.75rem, 14vw, 11.5rem)",
height: "var(--wordmark-h)",
width: "auto",
marginLeft: "calc(var(--wordmark-h) * -0.18)",
}}
"--wordmark-h": "clamp(4.75rem, 14vw, 11.5rem)",
height: "var(--wordmark-h)",
width: "auto",
marginLeft: "calc(var(--wordmark-h) * -0.18)",
} as React.CSSProperties}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — valid as a project-wide convention question, but not the right scope for this PR. The per-key ["--var" as string] cast is used 9× across 6 files today and there are zero as React.CSSProperties casts; switching this single site would create the codebase's first outlier (and the immediate neighbors in Close.tsx lines 39 and 49 still use the per-key form). Tracked for a sweep evaluation in #48.

/>
Comment thread
yigitdot marked this conversation as resolved.

{/* prettier-ignore */}
<p
Expand Down
Loading