Skip to content
Prev Previous commit
Next Next commit
chore: add external link icons to example links
  • Loading branch information
brettkolodny committed Jul 1, 2025
commit 30e6be82b5a05cb33c3634ffa40608deb0ee73c3
15 changes: 10 additions & 5 deletions src/client/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ import {
initWasm,
} from "@/utils/wasm";
import isEqual from "lodash/isEqual";
import { MoonIcon, ShareIcon, SunIcon, SunMoonIcon } from "lucide-react";
import {
ExternalLinkIcon,
MoonIcon,
ShareIcon,
SunIcon,
SunMoonIcon,
} from "lucide-react";
import { type FC, useEffect, useMemo, useRef, useState } from "react";
import { useDebouncedValue } from "./hooks/debounce";

Expand All @@ -45,9 +51,7 @@ export const App = () => {
}
return "loading";
});
const [code, setCode] = useState(
window.CODE ?? defaultCode,
);
const [code, setCode] = useState(window.CODE ?? defaultCode);
const [debouncedCode, isDebouncing] = useDebouncedValue(code, 1000);
const [parameterValues, setParameterValues] = useState<
Record<string, string>
Expand Down Expand Up @@ -313,11 +317,12 @@ const ExampleSelector: FC = () => {

<DropdownMenuPortal>
<DropdownMenuContent>
{Object.entries(examples).map(([ slug, title ]) => {
{Object.entries(examples).map(([slug, title]) => {
const href = `${window.location.origin}/parameters/example/${slug}`;
return (
<DropdownMenuItem key={slug} asChild={true}>
<a href={href} target="_blank" rel="noreferrer">
Copy link

Choose a reason for hiding this comment

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

It could be useful to show external link icons when opening external links

<ExternalLinkIcon />
{title}
</a>
</DropdownMenuItem>
Expand Down