mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 06:09:45 +00:00
3 files changed
+22
-9
No files matched your search
@@ -15,7 +15,11 @@ import {
|
||||
} from "@/widgets/ContactForm/variables";
|
||||
|
||||
const formSchema = z.object({
|
||||
name: z.string().min(1, "Обязательное поле"),
|
||||
name: z
|
||||
.string()
|
||||
.trim()
|
||||
.min(1, "Обязательное поле")
|
||||
.regex(/^[a-zA-Zа-яА-ЯёЁ\s-]+$/, "Имя может содержать только буквы и пробелы"),
|
||||
email: z.string().email("Некорректный email. Пример 123@sfedu.ru"),
|
||||
phone: z.string()
|
||||
.min(1, "Обязательное поле")
|
||||
@@ -145,6 +149,13 @@ function ContactForm() {
|
||||
});
|
||||
};
|
||||
|
||||
const handleNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
// Разрешены только буквы (латиница и кириллица), пробелы и дефисы
|
||||
const rawValue = e.target.value;
|
||||
const cleanedValue = rawValue.replace(/[^a-zA-Zа-яА-ЯёЁ\s-]/g, '');
|
||||
setValue("name", cleanedValue, { shouldValidate: true });
|
||||
};
|
||||
|
||||
return (
|
||||
<Form
|
||||
method="post"
|
||||
@@ -158,7 +169,9 @@ function ContactForm() {
|
||||
name="name"
|
||||
placeholder="Имя"
|
||||
disabled={isSubmitting || isPending}
|
||||
register={register("name")}
|
||||
register={register("name", {
|
||||
onChange: handleNameChange,
|
||||
})}
|
||||
error={errors.name?.message}
|
||||
/>
|
||||
<Field
|
||||
|
||||
@@ -94,7 +94,7 @@ function Footer({ links = mockLinks, contacts = mockContacts }: FooterProps) {
|
||||
<div className="footer-column">
|
||||
<Link to="/aboutus">О НАС</Link>
|
||||
<Link to="/contact">КОНТАКТЫ</Link>
|
||||
<Link to="https://ictis.sfedu.ru">ИКТИБ</Link>
|
||||
<a href="https://ictis.sfedu.ru" target="_blank" rel="noopener noreferrer">ИКТИБ</a>
|
||||
</div>
|
||||
</div>
|
||||
<Link className="visible" style={{ color: 'white', fontSize: '14px', alignItems: 'flex-end', lineHeight: 'none' }} to="https://www.study.sfedu.ru/privacypolicy?ysclid=m8anp507sz44008873">Политика конфиденциальности</Link>
|
||||
|
||||
@@ -12,9 +12,9 @@ const PhotoGallery = ({ images }: PhotoGalleryProps) => {
|
||||
const { data: mediaData, isLoading, isError } = useMedia();
|
||||
const [visibleCount] = useState(10);
|
||||
|
||||
const filteredMedia = images
|
||||
? images.map((src, id) => ({ id, src }))
|
||||
: mediaData || []; // без фильтра
|
||||
const filteredMedia = images
|
||||
? images.map((src, id) => ({ id, src }))
|
||||
: mediaData || []; // без фильтра
|
||||
|
||||
if (isLoading)
|
||||
return (
|
||||
@@ -27,7 +27,7 @@ const PhotoGallery = ({ images }: PhotoGalleryProps) => {
|
||||
|
||||
return (
|
||||
<div className="mainContainer">
|
||||
<h1 className="title">Фотогалерея</h1>
|
||||
<h1 className="title">Фотогалерея</h1>
|
||||
<div className="images">
|
||||
{filteredMedia.slice(0, visibleCount).map((media) => (
|
||||
<div key={media.id} className="image-container">
|
||||
@@ -41,8 +41,8 @@ const PhotoGallery = ({ images }: PhotoGalleryProps) => {
|
||||
</div>
|
||||
|
||||
<div className="btn">
|
||||
Показать еще
|
||||
</div>
|
||||
Загрузить ещё
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user