Skip to content

chore(site): refactor filter component to be more extendable #13688

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 16 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Apply PR suggestions
  • Loading branch information
BrunoQuaresma committed Jul 2, 2024
commit ebcbaa5125016db9976ea05661e271bc54b7fdbc
2 changes: 1 addition & 1 deletion site/src/components/Filter/SelectFilter.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "./SelectFilter";

const options: SelectFilterOption[] = Array.from({ length: 50 }, (_, i) => ({
startIcon: <UserAvatar username={`username ${i}`} size="xs" />,
startIcon: <UserAvatar username={`username ${i + 1}`} size="xs" />,
label: `Option ${i + 1}`,
value: `option-${i + 1}`,
}));
Expand Down
3 changes: 2 additions & 1 deletion site/src/components/SelectMenu/SelectMenu.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { action } from "@storybook/addon-actions";
import type { Meta, StoryObj } from "@storybook/react";
import { userEvent, within } from "@storybook/test";
import { UserAvatar } from "components/UserAvatar/UserAvatar";
Expand Down Expand Up @@ -109,7 +110,7 @@ export const NoSelectedOption: Story = {
<SelectMenuButton css={{ width: 200 }}>All users</SelectMenuButton>
</SelectMenuTrigger>
<SelectMenuContent>
<SelectMenuSearch onChange={() => {}} />
<SelectMenuSearch onChange={action("search")} />
<SelectMenuList>
{opts.map((o) => (
<SelectMenuItem key={o}>
Expand Down
5 changes: 1 addition & 4 deletions site/src/pages/WorkspacesPage/filter/menus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ export const useTemplateFilterMenu = ({
const template = templates.find((template) => template.name === value);
if (template) {
return {
label:
template.display_name !== ""
? template.display_name
: template.name,
label: template.display_name || template.name,
value: template.name,
startIcon: <TemplateAvatar size="xs" template={template} />,
};
Expand Down