Skip to content

Commit

Permalink
CW-Hotfix-staging Fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
MeyerPV committed Nov 27, 2023
1 parent 37a2e69 commit d06ea4f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useFormikContext } from "formik";
import { ProposalsTypes } from "@/shared/constants";
import { RightArrowThinIcon } from "@/shared/icons";
import { NewProposalCreationFormValues } from "@/shared/interfaces";
import { SelectorStyles } from "./selectorStyles";
import useThemeColor from "@/shared/hooks/useThemeColor";
import { selectorStyles } from "./selectorStyles";
import styles from "./ProposalTypeSelect.module.scss";

interface ProposalTypeSelectProps {
Expand Down Expand Up @@ -37,7 +38,9 @@ const getProposalOptions = (commonBalance: number) => {

const ProposalTypeSelect = ({ commonBalance }: ProposalTypeSelectProps) => {
const { values, setFieldValue, handleBlur, touched, errors } =
useFormikContext<NewProposalCreationFormValues>();
useFormikContext<NewProposalCreationFormValues>();

const { getThemeColor } = useThemeColor();
const hasError = Boolean(touched.proposalType && errors.proposalType);

return (
Expand All @@ -52,7 +55,7 @@ const ProposalTypeSelect = ({ commonBalance }: ProposalTypeSelectProps) => {
}}
onBlur={handleBlur("proposalType")}
hideSelectedOptions={false}
styles={SelectorStyles(hasError)}
styles={selectorStyles(hasError, getThemeColor)}
components={{
DropdownIndicator,
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ThemeColors } from "@/shared/constants";
import useThemeColor from "@/shared/hooks/useThemeColor";

export const SelectorStyles = (hasError: boolean) => {
const { getThemeColor } = useThemeColor();

export const selectorStyles = (hasError: boolean, getThemeColor: (color: ThemeColors) => string) => {
return {
menu: (provided) => ({ ...provided, zIndex: 10000 }),
menuPortal: (provided) => ({ ...provided, zIndex: 10000 }),
Expand Down
7 changes: 5 additions & 2 deletions src/shared/components/Form/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React, { FC } from "react";
import Select, { components, DropdownIndicatorProps } from "react-select";
import classNames from "classnames";
import { useFormikContext } from "formik";
import useThemeColor from "@/shared/hooks/useThemeColor";
import { RightArrowThinIcon } from "@/shared/icons";
import { SelectOptionType } from "@/shared/interfaces/Select";
import { SelectorStyles } from "./selectorStyles";
import { selectorStyles } from "./selectorStyles";
import styles from "./Select.module.scss";

interface FormSelectProps {
Expand Down Expand Up @@ -38,6 +39,8 @@ const FormSelect: FC<FormSelectProps> = ({
}) => {
const { values, setFieldValue, handleBlur, touched, errors } =
useFormikContext<Record<string, unknown>>();

const { getThemeColor } = useThemeColor();
const hasError = Boolean(touched[formName] && errors[formName]);

return (
Expand All @@ -54,7 +57,7 @@ const FormSelect: FC<FormSelectProps> = ({
}}
onBlur={handleBlur(formName)}
hideSelectedOptions={false}
styles={SelectorStyles(hasError)}
styles={selectorStyles(hasError, getThemeColor)}
components={{
DropdownIndicator,
}}
Expand Down
5 changes: 1 addition & 4 deletions src/shared/components/Form/Select/selectorStyles.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ThemeColors } from "@/shared/constants";
import useThemeColor from "@/shared/hooks/useThemeColor";

export const SelectorStyles = (hasError: boolean) => {
const { getThemeColor } = useThemeColor();

export const selectorStyles = (hasError: boolean, getThemeColor: (color: ThemeColors) => string) => {
return {
menu: (provided) => ({ ...provided, zIndex: 10000 }),
menuPortal: (provided) => ({ ...provided, zIndex: 10000 }),
Expand Down

0 comments on commit d06ea4f

Please sign in to comment.