mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Related to https://github.com/coder/coder/issues/17311 - Replaces the MUI Buttons by the new shadcn/ui buttons. This change allows the reuse of app links, and terminal buttons using the `asChild` capability from the Radix components - Uses the new [proposed design](https://www.figma.com/design/OR75XeUI0Z3ksqt1mHsNQw/Workspace-views?node-id=1014-8242&t=wtUXJRN1SfyZiFKn-0) - Updates the button styles to support image tags as icons - Uses the new Tooltip component for the app buttons **Before:** <img width="1243" alt="Screenshot 2025-05-05 at 17 55 49" src="https://github.com/user-attachments/assets/e689e9dc-d8e1-4c9d-ba09-ef1479a501f1" /> **After:** <img width="1264" alt="Screenshot 2025-05-05 at 18 05 38" src="https://github.com/user-attachments/assets/8fafbe20-f063-46ab-86cf-2e0381bba889" />
20 lines
522 B
TypeScript
20 lines
522 B
TypeScript
import { useTheme } from "@emotion/react";
|
|
import { type ImgHTMLAttributes, forwardRef } from "react";
|
|
import { getExternalImageStylesFromUrl } from "theme/externalImages";
|
|
|
|
export const ExternalImage = forwardRef<
|
|
HTMLImageElement,
|
|
ImgHTMLAttributes<HTMLImageElement>
|
|
>((props, ref) => {
|
|
const theme = useTheme();
|
|
|
|
return (
|
|
// biome-ignore lint/a11y/useAltText: alt should be passed in as a prop
|
|
<img
|
|
ref={ref}
|
|
css={getExternalImageStylesFromUrl(theme.externalImages, props.src)}
|
|
{...props}
|
|
/>
|
|
);
|
|
});
|