Compare commits

3 Commits

Author SHA1 Message Date
b3f95a6ad9 feat: footer for mobiles 2025-08-11 11:29:51 +04:00
3560afabcc fix: forms fix for mobiles 2025-08-11 11:00:57 +04:00
6caac5743b fix: memorizing country select 2025-08-11 10:19:40 +04:00
8 changed files with 59 additions and 27 deletions

View File

@ -55,8 +55,10 @@ const VerifyPhoneForm: FC = () => {
const navigateToLogin = () => redirect("/"); const navigateToLogin = () => redirect("/");
return ( return (
<form onSubmit={form.onSubmit(handleSubmit)}> <form
<Stack> style={{ justifyItems: "center" }}
onSubmit={form.onSubmit(handleSubmit)}>
<Stack maw={500}>
<PinInput <PinInput
length={6} length={6}
placeholder="_" placeholder="_"

View File

@ -6,11 +6,11 @@ import { Button, Stack } from "@mantine/core";
import { useForm } from "@mantine/form"; import { useForm } from "@mantine/form";
import { Auth } from "@/client"; import { Auth } from "@/client";
import PhoneInput from "@/components/ui/PhoneInput/PhoneInput"; import PhoneInput from "@/components/ui/PhoneInput/PhoneInput";
import { notifications } from "@/lib/notifications";
import { import {
setLoginChallenge, setLoginChallenge,
setPhoneNumber, setPhoneNumber,
} from "@/lib/store/features/auth/authSlice"; } from "@/lib/store/features/auth/authSlice";
import { notifications } from "@/lib/notifications";
import { useAppDispatch } from "@/lib/store/store"; import { useAppDispatch } from "@/lib/store/store";
type LoginForm = { type LoginForm = {
@ -69,8 +69,10 @@ const LoginForm: FC<Props> = ({ loginChallenge, isCreatingId = false }) => {
const navigateToLogin = () => router.push("/"); const navigateToLogin = () => router.push("/");
return ( return (
<form onSubmit={form.onSubmit(handleSubmit)}> <form
<Stack> style={{ justifyItems: "center" }}
onSubmit={form.onSubmit(handleSubmit)}>
<Stack maw={500}>
<PhoneInput <PhoneInput
{...form.getInputProps("phoneNumber")} {...form.getInputProps("phoneNumber")}
setPhoneMask={setPhoneMask} setPhoneMask={setPhoneMask}

View File

@ -0,0 +1,6 @@
.footer {
padding: var(--mantine-spacing-md);
@media (max-width: 48em) {
padding: 0
}
}

View File

@ -1,5 +1,6 @@
import Link from "next/link"; import Link from "next/link";
import { Group, Text } from "@mantine/core"; import { Group, Text } from "@mantine/core";
import styles from "@/components/layout/Footer/Footer.module.css";
const Footer = () => { const Footer = () => {
return ( return (
@ -7,7 +8,7 @@ const Footer = () => {
justify={"flex-end"} justify={"flex-end"}
align={"flex-end"} align={"flex-end"}
h={"7vh"} h={"7vh"}
p={"md"}> className={styles.footer}>
<Group gap={"xl"}> <Group gap={"xl"}>
<Link <Link
href={"#"} href={"#"}

View File

@ -37,5 +37,15 @@
bottom: 0; bottom: 0;
z-index: 100; z-index: 100;
overflow-y: auto; overflow-y: auto;
display: flex;
flex-direction: column;
}
}
.mobile-footer {
display: none;
@media (max-width: 48em) {
display: block;
margin-top: auto;
} }
} }

View File

@ -1,6 +1,7 @@
import { CSSProperties, FC, ReactNode } from "react"; import { CSSProperties, FC, ReactNode } from "react";
import classNames from "classnames"; import classNames from "classnames";
import { MotionWrapper } from "@/components/layout/MotionWrapper/MotionWrapper"; import { MotionWrapper } from "@/components/layout/MotionWrapper/MotionWrapper";
import Footer from "@/components/layout/Footer/Footer";
import styles from "./PageItem.module.css"; import styles from "./PageItem.module.css";
type Props = { type Props = {
@ -31,6 +32,11 @@ const PageItem: FC<Props> = ({
fullScreenMobile && styles["container-full-screen-mobile"] fullScreenMobile && styles["container-full-screen-mobile"]
)}> )}>
{children} {children}
{fullScreenMobile && (
<div className={styles["mobile-footer"]}>
<Footer />
</div>
)}
</div> </div>
); );

View File

@ -32,7 +32,7 @@ const Logo = ({ title }: Props) => {
<Title <Title
order={4} order={4}
mb={"lg"} mb={"lg"}
style={{ color: myColor[6] }}> style={{ color: myColor[6], textAlign: "center" }}>
{title} {title}
</Title> </Title>
</Center> </Center>

View File

@ -1,14 +1,16 @@
"use client"; "use client";
import { useEffect, useRef, useState } from "react"; import { useEffect, useMemo, useRef, useState } from "react";
import { IMaskInput } from "react-imask"; import { IMaskInput } from "react-imask";
import { import {
InputBase, InputBase,
type InputBaseProps, type InputBaseProps,
type PolymorphicComponentProps, type PolymorphicComponentProps,
} from "@mantine/core"; } from "@mantine/core";
import CountrySelect from "@/components/ui/PhoneInput/components/CountrySelect";
import { Country } from "@/components/ui/PhoneInput/types"; import { Country } from "@/components/ui/PhoneInput/types";
import getInitialDataFromValue from "@/components/ui/PhoneInput/utils/getInitialDataFromValue"; import getInitialDataFromValue from "@/components/ui/PhoneInput/utils/getInitialDataFromValue";
import getPhoneMask from "@/components/ui/PhoneInput/utils/getPhoneMask";
type AdditionalProps = { type AdditionalProps = {
onChange: (value: string | null) => void; onChange: (value: string | null) => void;
@ -60,28 +62,32 @@ const PhoneInput = ({
setDropdownWidth(inputRef.current?.offsetWidth); setDropdownWidth(inputRef.current?.offsetWidth);
}, [inputRef.current?.offsetWidth]); }, [inputRef.current?.offsetWidth]);
const countrySelect = useMemo(
() => (
<CountrySelect
disabled={disabled || readOnly}
country={country}
setCountry={country => {
setCountry(country);
setPhoneMask(getPhoneMask(country.code), country);
setValue("");
if (inputRef.current) {
inputRef.current.focus();
}
}}
leftSectionWidth={leftSectionWidth}
inputWidth={dropdownWidth}
/>
),
[country, leftSectionWidth, dropdownWidth, disabled, readOnly]
);
return ( return (
<InputBase <InputBase
{...props} {...props}
component={IMaskInput} component={IMaskInput}
inputRef={inputRef} inputRef={inputRef}
leftSection={ leftSection={countrySelect}
<></>
// <CountrySelect
// disabled={disabled || readOnly}
// country={country}
// setCountry={country => {
// setCountry(country);
// setPhoneMask(getPhoneMask(country.code), country);
// setValue("");
// if (inputRef.current) {
// inputRef.current.focus();
// }
// }}
// leftSectionWidth={leftSectionWidth}
// inputWidth={dropdownWidth}
// />
}
leftSectionWidth={leftSectionWidth} leftSectionWidth={leftSectionWidth}
styles={{ styles={{
input: { input: {
@ -93,7 +99,6 @@ const PhoneInput = ({
"1px solid var(--mantine-color-default-border)", "1px solid var(--mantine-color-default-border)",
}, },
}} }}
inputMode={"numeric"}
mask={mask} mask={mask}
value={value} value={value}
onAccept={onChange} onAccept={onChange}