warp phone component & fix background color after auto fit
This commit is contained in:
@@ -44,8 +44,8 @@ export function OfficeBottomSheet({
|
||||
title={t("address.officeDetails")}
|
||||
showCloseButton={false}
|
||||
initialSnap={1}
|
||||
height={"90vh"}
|
||||
snapPoints={["90vh"]}
|
||||
height={705}
|
||||
snapPoints={[705]}
|
||||
>
|
||||
<Form
|
||||
layout="vertical"
|
||||
|
||||
@@ -45,8 +45,8 @@ export function RoomBottomSheet({
|
||||
title={t("address.roomDetails")}
|
||||
showCloseButton={false}
|
||||
initialSnap={1}
|
||||
height={"85vh"}
|
||||
snapPoints={["85vh"]}
|
||||
height={680}
|
||||
snapPoints={[680]}
|
||||
>
|
||||
<Form
|
||||
layout="vertical"
|
||||
|
||||
77
src/components/ProPhoneInput.tsx
Normal file
77
src/components/ProPhoneInput.tsx
Normal file
@@ -0,0 +1,77 @@
|
||||
import { Form } from "antd";
|
||||
import { TitleProps } from "antd/es/typography/Title";
|
||||
import { FunctionComponent } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import PhoneInput from "react-phone-input-2";
|
||||
import { useAppSelector } from "redux/hooks";
|
||||
import { ProBlack1 } from "ThemeConstants";
|
||||
|
||||
interface ProPhoneInput extends TitleProps {
|
||||
phone: string;
|
||||
setPhone: (phone: string) => void;
|
||||
}
|
||||
|
||||
const ProPhoneInput: FunctionComponent<ProPhoneInput> = ({ phone, setPhone }) => {
|
||||
const { t } = useTranslation();
|
||||
const { themeName } = useAppSelector((state) => state.theme);
|
||||
const { isRTL } = useAppSelector((state) => state.locale);
|
||||
|
||||
return (
|
||||
<Form.Item
|
||||
name="phone"
|
||||
label={t("login.phone")}
|
||||
rules={[
|
||||
{ required: true, message: "" },
|
||||
{ type: "number", message: "" },
|
||||
]}
|
||||
>
|
||||
<div className="pro-phone-input">
|
||||
<PhoneInput
|
||||
country={"om"}
|
||||
inputStyle={{
|
||||
borderRadius: 1000,
|
||||
height: 50,
|
||||
width: "100%",
|
||||
color: themeName === "light" ? "#000" : "#FFF",
|
||||
backgroundColor: themeName === "light" ? "#FFF" : ProBlack1,
|
||||
textAlign: isRTL ? "right" : "left",
|
||||
direction: isRTL ? "rtl" : "ltr",
|
||||
paddingLeft: "50px",
|
||||
paddingRight: "50px",
|
||||
borderColor: themeName === "light" ? "#d9d9d9" : "#363636",
|
||||
}}
|
||||
placeholder={t("login.mobileNumber")}
|
||||
value={phone}
|
||||
buttonStyle={{
|
||||
backgroundColor: "transparent",
|
||||
border: 0,
|
||||
borderLeft: "1px solid #363636",
|
||||
borderRadius: 0,
|
||||
position: "relative",
|
||||
...(isRTL && {
|
||||
top: -25,
|
||||
right: 25,
|
||||
}),
|
||||
...(!isRTL && {
|
||||
top: -25,
|
||||
}),
|
||||
}}
|
||||
onBlur={(e) => setPhone(e.target.value)}
|
||||
autocompleteSearch
|
||||
inputProps={{
|
||||
id: "phone", // Required for accessibility & autofill
|
||||
name: "phone",
|
||||
required: true,
|
||||
autoFocus: false,
|
||||
autoComplete: "tel",
|
||||
type: "tel",
|
||||
inputMode: "numeric",
|
||||
pattern: "[0-9]*",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Form.Item>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProPhoneInput;
|
||||
@@ -11,7 +11,7 @@
|
||||
--secondary-background: #ffffff;
|
||||
--secondary-foreground: #0a0a0a;
|
||||
--primary-dark: #0a0a0a;
|
||||
--primary: #FFD633;
|
||||
--primary: #ffd633;
|
||||
--primary2: #ffc600;
|
||||
--secondary: #09237d;
|
||||
--text-color: #fff;
|
||||
@@ -330,3 +330,51 @@ label {
|
||||
padding: 16px 16px 8px 16px !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
/* Override PhoneInput autofill background styles */
|
||||
.pro-phone-input :where(.react-tel-input input) {
|
||||
transition: background-color 5000s ease-in-out 0s !important;
|
||||
}
|
||||
|
||||
.pro-phone-input :where(.react-tel-input input:-webkit-autofill),
|
||||
.pro-phone-input :where(.react-tel-input input:-webkit-autofill:hover),
|
||||
.pro-phone-input :where(.react-tel-input input:-webkit-autofill:focus),
|
||||
.pro-phone-input :where(.react-tel-input input:-webkit-autofill:active) {
|
||||
-webkit-box-shadow: 0 0 0 30px var(--secondary-background) inset !important;
|
||||
-webkit-text-fill-color: var(--secondary-foreground) !important;
|
||||
background-color: transparent !important;
|
||||
background-image: none !important;
|
||||
transition: background-color 5000s ease-in-out 0s !important;
|
||||
}
|
||||
|
||||
/* Dark theme PhoneInput autofill overrides */
|
||||
:where(.darkApp)
|
||||
.pro-phone-input
|
||||
:where(.react-tel-input input:-webkit-autofill),
|
||||
:where(.darkApp)
|
||||
.pro-phone-input
|
||||
:where(.react-tel-input input:-webkit-autofill:hover),
|
||||
:where(.darkApp)
|
||||
.pro-phone-input
|
||||
:where(.react-tel-input input:-webkit-autofill:focus),
|
||||
:where(.darkApp)
|
||||
.pro-phone-input
|
||||
:where(.react-tel-input input:-webkit-autofill:active),
|
||||
:where([data-theme="dark"])
|
||||
.pro-phone-input
|
||||
:where(.react-tel-input input:-webkit-autofill),
|
||||
:where([data-theme="dark"])
|
||||
.pro-phone-input
|
||||
:where(.react-tel-input input:-webkit-autofill:hover),
|
||||
:where([data-theme="dark"])
|
||||
.pro-phone-input
|
||||
:where(.react-tel-input input:-webkit-autofill:focus),
|
||||
:where([data-theme="dark"])
|
||||
.pro-phone-input
|
||||
:where(.react-tel-input input:-webkit-autofill:active) {
|
||||
-webkit-box-shadow: 0 0 0 30px var(--background) inset !important;
|
||||
-webkit-text-fill-color: var(--secondary-foreground) !important;
|
||||
background-color: transparent !important;
|
||||
background-image: none !important;
|
||||
transition: background-color 5000s ease-in-out 0s !important;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ export const GiftDetails = () => {
|
||||
type="primary"
|
||||
size="small"
|
||||
onClick={handleOfficeBottomSheetOpen}
|
||||
style={{ boxShadow: "none" }}
|
||||
>
|
||||
{buttonText}
|
||||
</Button>
|
||||
|
||||
@@ -58,6 +58,7 @@ export const OfficeDetails = () => {
|
||||
type="primary"
|
||||
size="small"
|
||||
onClick={handleOfficeBottomSheetOpen}
|
||||
style={{ boxShadow: "none" }}
|
||||
>
|
||||
{buttonText}
|
||||
</Button>
|
||||
|
||||
@@ -57,6 +57,7 @@ export const RoomDetails = () => {
|
||||
type="primary"
|
||||
size="small"
|
||||
onClick={handleRoomBottomSheetOpen}
|
||||
style={{ boxShadow: "none" }}
|
||||
>
|
||||
{buttonText}
|
||||
</Button>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
.loginPage {
|
||||
background-color: #FFF;
|
||||
background-color: var(--secondary-background);
|
||||
}
|
||||
|
||||
:global(.darkApp) .loginPage {
|
||||
background-color: var(--background);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
import { Button, Form, Input, message } from "antd";
|
||||
import DatePickerBottomSheet from "components/CustomBottomSheet/DatePickerBottomSheet";
|
||||
import LoginManIcon from "components/Icons/LoginManIcon";
|
||||
import ProPhoneInput from "components/ProPhoneInput";
|
||||
import ProText from "components/ProText";
|
||||
import ProTitle from "components/ProTitle";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import PhoneInput from "react-phone-input-2";
|
||||
import "react-phone-input-2/lib/style.css";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useSendOtpMutation } from "redux/api/auth";
|
||||
import { useAppSelector } from "redux/hooks";
|
||||
import { colors, DisabledColor, ProBlack1, ProGray1 } from "ThemeConstants";
|
||||
import { colors, DisabledColor, ProGray1 } from "ThemeConstants";
|
||||
import styles from "./login.module.css";
|
||||
|
||||
export default function LoginPage() {
|
||||
@@ -109,60 +109,7 @@ export default function LoginPage() {
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="phone"
|
||||
label={t("login.phone")}
|
||||
rules={[
|
||||
{ required: true, message: "" },
|
||||
{ type: "number", message: "" },
|
||||
]}
|
||||
>
|
||||
<div className={styles.proPhoneNumber}>
|
||||
<PhoneInput
|
||||
country={"om"}
|
||||
inputStyle={{
|
||||
borderRadius: 1000,
|
||||
height: 50,
|
||||
width: "100%",
|
||||
color: themeName === "light" ? "#000" : "#FFF",
|
||||
backgroundColor: themeName === "light" ? "#FFF" : ProBlack1,
|
||||
textAlign: isRTL ? "right" : "left",
|
||||
direction: isRTL ? "rtl" : "ltr",
|
||||
paddingLeft: "50px",
|
||||
paddingRight: "50px",
|
||||
borderColor: themeName === "light" ? "#d9d9d9" : "#363636",
|
||||
}}
|
||||
placeholder={t("login.mobileNumber")}
|
||||
value={phone}
|
||||
buttonStyle={{
|
||||
backgroundColor: "transparent",
|
||||
border: 0,
|
||||
borderLeft: "1px solid #363636",
|
||||
borderRadius: 0,
|
||||
position: "relative",
|
||||
...(isRTL && {
|
||||
top: -25,
|
||||
right: 25,
|
||||
}),
|
||||
...(!isRTL && {
|
||||
top: -25,
|
||||
}),
|
||||
}}
|
||||
onBlur={(e) => setPhone(e.target.value)}
|
||||
autocompleteSearch
|
||||
inputProps={{
|
||||
id: "phone-number", // Required for accessibility & autofill
|
||||
name: "phone-number",
|
||||
required: true,
|
||||
autoFocus: false,
|
||||
autoComplete: "tel",
|
||||
type: "tel",
|
||||
inputMode: "numeric",
|
||||
pattern: "[0-9]*",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Form.Item>
|
||||
<ProPhoneInput phone={phone} setPhone={setPhone} />
|
||||
|
||||
<Form.Item label={null}>
|
||||
<Button
|
||||
@@ -201,7 +148,7 @@ export default function LoginPage() {
|
||||
setSelectedDate(formattedDate);
|
||||
form.setFieldValue("date", formattedDate);
|
||||
}}
|
||||
initialDate={new Date()}
|
||||
initialDate={new Date(1990, 0, 1)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user