warp phone component & fix background color after auto fit

This commit is contained in:
2025-10-23 17:24:12 +03:00
parent 42882069a7
commit 3aeaa0a9f3
9 changed files with 142 additions and 68 deletions

View File

@@ -44,8 +44,8 @@ export function OfficeBottomSheet({
title={t("address.officeDetails")} title={t("address.officeDetails")}
showCloseButton={false} showCloseButton={false}
initialSnap={1} initialSnap={1}
height={"90vh"} height={705}
snapPoints={["90vh"]} snapPoints={[705]}
> >
<Form <Form
layout="vertical" layout="vertical"

View File

@@ -45,8 +45,8 @@ export function RoomBottomSheet({
title={t("address.roomDetails")} title={t("address.roomDetails")}
showCloseButton={false} showCloseButton={false}
initialSnap={1} initialSnap={1}
height={"85vh"} height={680}
snapPoints={["85vh"]} snapPoints={[680]}
> >
<Form <Form
layout="vertical" layout="vertical"

View 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;

View File

@@ -11,7 +11,7 @@
--secondary-background: #ffffff; --secondary-background: #ffffff;
--secondary-foreground: #0a0a0a; --secondary-foreground: #0a0a0a;
--primary-dark: #0a0a0a; --primary-dark: #0a0a0a;
--primary: #FFD633; --primary: #ffd633;
--primary2: #ffc600; --primary2: #ffc600;
--secondary: #09237d; --secondary: #09237d;
--text-color: #fff; --text-color: #fff;
@@ -330,3 +330,51 @@ label {
padding: 16px 16px 8px 16px !important; padding: 16px 16px 8px 16px !important;
box-shadow: none !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;
}

View File

@@ -68,6 +68,7 @@ export const GiftDetails = () => {
type="primary" type="primary"
size="small" size="small"
onClick={handleOfficeBottomSheetOpen} onClick={handleOfficeBottomSheetOpen}
style={{ boxShadow: "none" }}
> >
{buttonText} {buttonText}
</Button> </Button>

View File

@@ -58,6 +58,7 @@ export const OfficeDetails = () => {
type="primary" type="primary"
size="small" size="small"
onClick={handleOfficeBottomSheetOpen} onClick={handleOfficeBottomSheetOpen}
style={{ boxShadow: "none" }}
> >
{buttonText} {buttonText}
</Button> </Button>

View File

@@ -57,6 +57,7 @@ export const RoomDetails = () => {
type="primary" type="primary"
size="small" size="small"
onClick={handleRoomBottomSheetOpen} onClick={handleRoomBottomSheetOpen}
style={{ boxShadow: "none" }}
> >
{buttonText} {buttonText}
</Button> </Button>

View File

@@ -1,8 +1,7 @@
.loginPage { .loginPage {
background-color: #FFF; background-color: var(--secondary-background);
} }
:global(.darkApp) .loginPage { :global(.darkApp) .loginPage {
background-color: var(--background); background-color: var(--background);
} }

View File

@@ -3,16 +3,16 @@
import { Button, Form, Input, message } from "antd"; import { Button, Form, Input, message } from "antd";
import DatePickerBottomSheet from "components/CustomBottomSheet/DatePickerBottomSheet"; import DatePickerBottomSheet from "components/CustomBottomSheet/DatePickerBottomSheet";
import LoginManIcon from "components/Icons/LoginManIcon"; import LoginManIcon from "components/Icons/LoginManIcon";
import ProPhoneInput from "components/ProPhoneInput";
import ProText from "components/ProText"; import ProText from "components/ProText";
import ProTitle from "components/ProTitle"; import ProTitle from "components/ProTitle";
import { useState } from "react"; import { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import PhoneInput from "react-phone-input-2";
import "react-phone-input-2/lib/style.css"; import "react-phone-input-2/lib/style.css";
import { useNavigate, useParams } from "react-router-dom"; import { useNavigate, useParams } from "react-router-dom";
import { useSendOtpMutation } from "redux/api/auth"; import { useSendOtpMutation } from "redux/api/auth";
import { useAppSelector } from "redux/hooks"; import { useAppSelector } from "redux/hooks";
import { colors, DisabledColor, ProBlack1, ProGray1 } from "ThemeConstants"; import { colors, DisabledColor, ProGray1 } from "ThemeConstants";
import styles from "./login.module.css"; import styles from "./login.module.css";
export default function LoginPage() { export default function LoginPage() {
@@ -109,60 +109,7 @@ export default function LoginPage() {
/> />
</Form.Item> </Form.Item>
<Form.Item <ProPhoneInput phone={phone} setPhone={setPhone} />
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>
<Form.Item label={null}> <Form.Item label={null}>
<Button <Button
@@ -201,7 +148,7 @@ export default function LoginPage() {
setSelectedDate(formattedDate); setSelectedDate(formattedDate);
form.setFieldValue("date", formattedDate); form.setFieldValue("date", formattedDate);
}} }}
initialDate={new Date()} initialDate={new Date(1990, 0, 1)}
/> />
</div> </div>
); );