Skip to content

chore: replace MUI Button - 3 #17955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 21, 2025
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
6 changes: 4 additions & 2 deletions site/src/components/Filter/Filter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useTheme } from "@emotion/react";
import Button from "@mui/material/Button";
import Divider from "@mui/material/Divider";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
Expand All @@ -10,6 +9,7 @@ import {
hasError,
isApiValidationError,
} from "api/errors";
import { Button } from "components/Button/Button";
import { InputGroup } from "components/InputGroup/InputGroup";
import { SearchField } from "components/SearchField/SearchField";
import { useDebouncedFunction } from "hooks/debounce";
Expand Down Expand Up @@ -267,9 +267,11 @@ const PresetMenu: FC<PresetMenuProps> = ({
<Button
onClick={() => setIsOpen(true)}
ref={anchorRef}
endIcon={<ChevronDownIcon className="size-4" />}
variant="outline"
className="h-9"
>
Filters
<ChevronDownIcon />
</Button>
<Menu
id="filter-menu"
Expand Down
12 changes: 4 additions & 8 deletions site/src/pages/ChatPage/ChatLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useTheme } from "@emotion/react";
import Button from "@mui/material/Button";
import List from "@mui/material/List";
import ListItem from "@mui/material/ListItem";
import ListItemButton from "@mui/material/ListItemButton";
Expand All @@ -9,6 +8,7 @@ import { createChat, getChats } from "api/queries/chats";
import { deploymentLanguageModels } from "api/queries/deployment";
import type { LanguageModelConfig } from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Button } from "components/Button/Button";
import { Loader } from "components/Loader/Loader";
import { Margins } from "components/Margins/Margins";
import { useAgenticChat } from "contexts/useAgenticChat";
Expand Down Expand Up @@ -167,16 +167,12 @@ export const ChatLayout: FC = () => {
Chats
</div>
<Button
variant="outlined"
size="small"
startIcon={<PlusIcon className="size-icon-sm" />}
variant="outline"
size="sm"
onClick={handleNewChat}
disabled={createChatMutation.isLoading}
css={{
lineHeight: 1.5,
padding: theme.spacing(0.5, 1.5),
}}
>
<PlusIcon />
New Chat
</Button>
</div>
Expand Down
27 changes: 11 additions & 16 deletions site/src/pages/StarterTemplatePage/StarterTemplatePageView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTheme } from "@emotion/react";
import Button from "@mui/material/Button";
import type { TemplateExample } from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Button } from "components/Button/Button";
import { ExternalImage } from "components/ExternalImage/ExternalImage";
import { Loader } from "components/Loader/Loader";
import { Margins } from "components/Margins/Margins";
Expand Down Expand Up @@ -44,22 +44,17 @@ export const StarterTemplatePageView: FC<StarterTemplatePageViewProps> = ({
<PageHeader
actions={
<>
<Button
component="a"
target="_blank"
href={starterTemplate.url}
rel="noreferrer"
startIcon={<ExternalLinkIcon className="size-icon-sm" />}
>
View source code
<Button asChild variant="outline" size="sm">
<a target="_blank" href={starterTemplate.url} rel="noreferrer">
<ExternalLinkIcon />
View source code
</a>
</Button>
<Button
variant="contained"
component={Link}
to={`/templates/new?exampleId=${starterTemplate.id}`}
startIcon={<PlusIcon className="size-icon-sm" />}
>
Use template
<Button asChild size="sm">
<Link to={`/templates/new?exampleId=${starterTemplate.id}`}>
<PlusIcon />
Use template
</Link>
Comment on lines +53 to +57

Choose a reason for hiding this comment

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

Nit: I think differentiating these two buttons with outline/default variants is the right call, but the Use template button's left padding with the icon's whitespace is large, so the button contents look unbalanced

main:

image

this branch:

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if I got it.... 🤔

Choose a reason for hiding this comment

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

Screenshot 2025-05-21 at 12 12 48 PM

No big deal haha. Being that Button has equal px on the left/right, I feel like adding unequal x-padding like this in Button variants (or case-by-case for each icon?) would be a bit of a pain

</Button>
</>
}
Expand Down
10 changes: 4 additions & 6 deletions site/src/pages/TemplatePage/TemplateInsightsPage/DateRange.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import "react-date-range/dist/styles.css";
import "react-date-range/dist/theme/default.css";
import type { Interpolation, Theme } from "@emotion/react";
import ArrowRightAltOutlined from "@mui/icons-material/ArrowRightAltOutlined";
import Button from "@mui/material/Button";
import { Button } from "components/Button/Button";
import {
Popover,
PopoverContent,
Expand All @@ -17,6 +16,7 @@ import {
startOfHour,
subDays,
} from "date-fns";
import { MoveRightIcon } from "lucide-react";
import { type ComponentProps, type FC, useRef, useState } from "react";
import { DateRangePicker, createStaticRanges } from "react-date-range";

Expand Down Expand Up @@ -54,11 +54,9 @@ export const DateRange: FC<DateRangeProps> = ({ value, onChange }) => {
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger>
<Button>
<Button variant="outline">
<span>{format(value.startDate, "MMM d, Y")}</span>
<ArrowRightAltOutlined
css={{ width: 16, height: 16, marginLeft: 8, marginRight: 8 }}
/>
<MoveRightIcon />
<span>{format(value.endDate, "MMM d, Y")}</span>
</Button>
</PopoverTrigger>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Interpolation, type Theme, useTheme } from "@emotion/react";
import Button, { type ButtonProps } from "@mui/material/Button";
import type { AlertProps } from "components/Alert/Alert";
import { Button, type ButtonProps } from "components/Button/Button";
import { Pill } from "components/Pill/Pill";
import {
Popover,
Expand Down Expand Up @@ -89,28 +89,13 @@ const NotificationItem: FC<NotificationItemProps> = ({ notification }) => {
{notification.detail && (
<p css={styles.notificationDetail}>{notification.detail}</p>
)}
<div css={{ marginTop: 8 }}>{notification.actions}</div>
<div className="mt-2 flex items-center gap-1">{notification.actions}</div>
</article>
);
};

export const NotificationActionButton: FC<ButtonProps> = (props) => {
return (
<Button
variant="text"
css={{
textDecoration: "underline",
paddingLeft: 0,
paddingRight: 8,
paddingTop: 0,
paddingBottom: 0,
height: "auto",
minWidth: "auto",
"&:hover": { background: "none", textDecoration: "underline" },
}}
{...props}
/>
);
return <Button variant="outline" size="sm" {...props} />;
};

const styles = {
Expand Down
Loading