Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3d1c952

Browse files
f0sselclaude
andcommitted
refactor: use standardized Link component for registry links
Replace custom styled links with the existing Link component that: - Provides consistent styling and behavior - Includes proper external link icon (SquareArrowOutUpRightIcon) - Has built-in accessibility features and focus states - Removes duplicate custom CSS for link styling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d112320 commit 3d1c952

File tree

2 files changed

+7
-40
lines changed

2 files changed

+7
-40
lines changed

site/src/pages/CreateTemplateGalleryPage/CreateTemplateGalleryPageView.tsx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import CardContent from "@mui/material/CardContent";
55
import Stack from "@mui/material/Stack";
66
import { ErrorAlert } from "components/Alert/ErrorAlert";
77
import { ExternalImage } from "components/ExternalImage/ExternalImage";
8+
import { Link } from "components/Link/Link";
89
import { Loader } from "components/Loader/Loader";
910
import { Margins } from "components/Margins/Margins";
1011
import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader";
11-
import { ExternalLinkIcon } from "lucide-react";
1212
import type { FC } from "react";
1313
import { Link as RouterLink } from "react-router-dom";
1414
import type { StarterTemplatesByTag } from "utils/starterTemplates";
@@ -26,15 +26,13 @@ export const CreateTemplateGalleryPageView: FC<
2626
<Margins>
2727
<PageHeader
2828
actions={
29-
<a
29+
<Link
3030
href="https://registry.coder.com"
3131
target="_blank"
3232
rel="noopener noreferrer"
33-
css={styles.registryLink}
3433
>
3534
Browse the Coder Registry
36-
<ExternalLinkIcon className="size-4" />
37-
</a>
35+
</Link>
3836
}
3937
>
4038
<PageHeaderTitle>Create a Template</PageHeaderTitle>
@@ -132,19 +130,4 @@ const styles = {
132130
width: 20,
133131
height: 20,
134132
}),
135-
136-
registryLink: (theme) => ({
137-
display: "flex",
138-
alignItems: "center",
139-
gap: 8,
140-
color: theme.palette.text.secondary,
141-
textDecoration: "none",
142-
fontSize: 14,
143-
fontWeight: 500,
144-
145-
"&:hover": {
146-
color: theme.palette.text.primary,
147-
textDecoration: "underline",
148-
},
149-
}),
150133
} satisfies Record<string, Interpolation<Theme>>;

site/src/pages/TemplateVersionEditorPage/TemplateVersionEditor.tsx

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ import {
2222
TopbarIconButton,
2323
} from "components/FullPageLayout/Topbar";
2424
import { displayError } from "components/GlobalSnackbar/utils";
25+
import { Link } from "components/Link/Link";
2526
import { Loader } from "components/Loader/Loader";
2627
import { TriangleAlertIcon } from "lucide-react";
2728
import { ChevronLeftIcon } from "lucide-react";
28-
import { PlayIcon, PlusIcon, XIcon, ExternalLinkIcon } from "lucide-react";
29+
import { PlayIcon, PlusIcon, XIcon } from "lucide-react";
2930
import { linkToTemplate, useLinks } from "modules/navigation";
3031
import { ProvisionerAlert } from "modules/provisioners/ProvisionerAlert";
3132
import { AlertVariant } from "modules/provisioners/ProvisionerAlert";
@@ -274,15 +275,13 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
274275
/>
275276
</div>
276277

277-
<a
278+
<Link
278279
href="https://registry.coder.com"
279280
target="_blank"
280281
rel="noopener noreferrer"
281-
css={styles.registryLink}
282282
>
283283
Browse the Coder Registry
284-
<ExternalLinkIcon className="size-4" />
285-
</a>
284+
</Link>
286285

287286
<TopbarButton
288287
variant="default"
@@ -804,19 +803,4 @@ const styles = {
804803
},
805804
},
806805
},
807-
808-
registryLink: (theme) => ({
809-
display: "flex",
810-
alignItems: "center",
811-
gap: 8,
812-
color: theme.palette.text.secondary,
813-
textDecoration: "none",
814-
fontSize: 14,
815-
fontWeight: 500,
816-
817-
"&:hover": {
818-
color: theme.palette.text.primary,
819-
textDecoration: "underline",
820-
},
821-
}),
822806
} satisfies Record<string, Interpolation<Theme>>;

0 commit comments

Comments
 (0)