Skip to content
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

[CFE-599]: Refactor(components): react select input #1149

Merged
merged 4 commits into from
Sep 17, 2024
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
4 changes: 2 additions & 2 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Preview } from "@storybook/react";
import customTheme from "../src/lib/styles/theme";
import defaultTheme from "../src/lib/styles/theme";

const preview: Preview = {
parameters: {
Expand All @@ -11,7 +11,7 @@ const preview: Preview = {
},
},
chakra: {
theme: customTheme,
theme: defaultTheme,
},
},
};
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improvements

- [#1149](https://github.com/alleslabs/celatone-frontend/pull/1149) Refactor component react select input
- [#1094](https://github.com/alleslabs/celatone-frontend/pull/1094) Replace getFirstQueryParam with zod validation

### Bug fixes
Expand Down
1,550 changes: 846 additions & 704 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/lib/components/TxRelationSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box } from "@chakra-ui/react";

import type { Option } from "lib/types";

import { SelectInput } from "./forms";
import { SelectInputBase } from "./forms";

enum RelationType {
ALL = "ALL",
Expand Down Expand Up @@ -55,7 +55,7 @@ export const TxRelationSelection = ({

return (
<Box {...props}>
<SelectInput
<SelectInputBase
formLabel="Filter by Relation"
size={size}
options={relationOptions}
Expand Down
31 changes: 4 additions & 27 deletions src/lib/components/abi/args-form/field/ArgFieldWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Input, Textarea } from "@chakra-ui/react";
import { Select } from "chakra-react-select";
import type { ControllerRenderProps } from "react-hook-form";

import { useCurrentChain, useExampleAddresses } from "lib/app-provider";
import { SelectInput } from "lib/components/forms";
import type { BechAddr20, Nullable } from "lib/types";

import {
Expand Down Expand Up @@ -86,39 +86,16 @@ export const ArgFieldWidget = ({

if (type === "bool")
return (
<Select
<SelectInput
classNamePrefix="chakra-react-select"
size="md"
options={boolOptions}
placeholder={" "}
placeholder=""
value={boolOptions.find(
({ value: optionValue }) => optionValue === value
)}
onChange={(e) => onChange(e?.value)}
menuPosition="fixed"
onChange={(newValue) => onChange(newValue?.value)}
menuPortalTarget={document.body}
chakraStyles={{
control: (provided) => ({
...provided,
_disabled: {
color: "text.main",
},
}),
dropdownIndicator: (provided, state) => ({
...provided,
color: state.isDisabled ? "gray.700" : undefined,
}),
option: (provided) => ({
...provided,
color: "text.main",
_hover: {
bg: "gray.700",
},
_selected: {
bg: "gray.800",
},
}),
}}
/>
);

Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/forms/FilterByPermission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Grid } from "@chakra-ui/react";
import type { IconKeys } from "../icon";
import type { PermissionFilterValue } from "lib/hooks";

import { SelectInput } from "./SelectInput";
import { SelectInputBase } from "./SelectInputBase";

interface PermissionOption {
label: string;
Expand Down Expand Up @@ -51,7 +51,7 @@ export const FilterByPermission = ({
maxWidth = "360px",
}: FilterByPermissionProps) => (
<Grid columnGap={4} w="full" maxW={{ md: maxWidth }}>
<SelectInput<PermissionFilterValue>
<SelectInputBase<PermissionFilterValue>
formLabel="Filter by Instantiate Permission"
options={options}
onChange={setPermissionValue}
Expand Down
Loading
Loading