update src/components/CustomSwitch/index.js and src/components/FormInput/index.js

master
mahdi 3 years ago
parent 942a861b46
commit 1f641bd7d9
  1. 17
      src/components/CustomSwitch/index.js
  2. 2
      src/components/FormInput/index.js

@ -18,10 +18,10 @@ const CustomSwitch = ({
setValue(!value); setValue(!value);
register.onChange({ target: { name: register.name, value: !value } }); register.onChange({ target: { name: register.name, value: !value } });
}} }}
className={`${className} flex border border-blue-500 relative ${ className={`${className} flex border relative w-full ${
values values
? "rounded h-full min-h-[50px]" ? "rounded-md h-full min-h-[50px]"
: " rounded-full h-9 aspect-[1/2]" : " rounded-md h-9 aspect-[1/2]"
}`} }`}
> >
<input <input
@ -40,21 +40,20 @@ const CustomSwitch = ({
: "h-[89%] rounded-full aspect-square" : "h-[89%] rounded-full aspect-square"
}`} }`}
></div> ></div>
{values ? ( {values ? (
<div className=" w-[98%] h-[90%] flex flex-row-reverse right-[1%] top-[5%] z-10 absolute text-color19"> <div className=" w-[98%] h-[90%] flex flex-row-reverse right-[1%] top-[5%] z-10 absolute text-white">
<div <div
className={ className={
" w-1/2 h-full flex items-center justify-center cursor-pointer " + " w-1/2 h-full flex items-center justify-center cursor-pointer text-xs" +
(value ? "text-white" : "") (value ? "text-[#2483E1]" : "")
} }
> >
{values[1]} {values[1]}
</div> </div>
<div <div
className={ className={
" w-1/2 h-full flex items-center justify-center cursor-pointer " + " w-1/2 h-full flex items-center justify-center cursor-pointer text-xs" +
(!value ? "text-white" : "") (!value ? "text-[#2483E1]" : "")
} }
> >
{values[0]} {values[0]}

@ -43,7 +43,7 @@ const FormInput = ({ items }) => {
<CustomSelectBox /> <CustomSelectBox />
<CustomSwitch <CustomSwitch
register={register("gender")} register={register("gender")}
className="flex-1 mx-5" className="flex-1 bg-[#F9F9F9] border-[#E0E0E0]"
// defaultValue={activeUser?.gender} // defaultValue={activeUser?.gender}
values={["خانم", "آقا"]} values={["خانم", "آقا"]}
/> />

Loading…
Cancel
Save