вынесен заголовок регистрации

This commit is contained in:
admin 2024-12-10 20:47:16 +03:00
parent ca360b2451
commit f8f6fb991a
5 changed files with 43 additions and 35 deletions

View File

@ -2,27 +2,30 @@ import * as React from 'react';
import {Button, TextField, Grid, Box,
Typography, Container
} from '@mui/material';
import Photo from './photo/photo';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import Title from './title';
import Photo from './photo';
import axios from 'axios';
import student_icon from './student-icon.png';
import "./index.css";
//import useTelegram from "../hooks/useTelegram";
import Select from 'react-select';
import makeAnimated from 'react-select/animated';
import { useState } from 'react';
import { useConstant } from '../Constant';
const animatedComponents = makeAnimated();
const theme = createTheme();
const SingUpPage = (): React.ReactElement => {
const [selectedPhoto, setSelectedPhoto] = useState(null);
const [selectedOption, setSelectedOption] = useState<string | null>(null);
const handlePhotoChange = (photo) => {
setSelectedPhoto(photo);
};
const handleChange = (selectedOption) => {
setSelectedOption(selectedOption);
};
const { interests } = useConstant();
//const { user_id, username, onClose } = useTelegram();
/*
@ -45,12 +48,7 @@ const SingUpPage = (): React.ReactElement => {
};
*/
const handlePhotoChange = (photo) => {
setSelectedPhoto(photo); // Сохраняем выбранное изображение
};
return (
<ThemeProvider theme={theme}>
<Container component="main" maxWidth="xs">
<Box
sx={{
@ -60,9 +58,7 @@ const SingUpPage = (): React.ReactElement => {
alignItems: 'center',
}}
>
<Typography component="h1" variant="h5">
Регистрация
</Typography>
<Title>Регистрация</Title>
<Box component="form" noValidate sx={{ mt: 3 }}>
<Grid container spacing={2}>
<Grid item xs={12} sm={6}>
@ -119,7 +115,6 @@ const SingUpPage = (): React.ReactElement => {
<Select
onChange={handleChange}
closeMenuOnSelect={false}
components={animatedComponents}
isMulti
options={interests}
className="basic-multi-select"
@ -138,7 +133,6 @@ const SingUpPage = (): React.ReactElement => {
</Box>
</Box>
</Container>
</ThemeProvider>
);
};

View File

@ -0,0 +1,17 @@
import styled from '@emotion/styled';
import Avatar from "@mui/material/Avatar";
export const PhotoStyled = styled.div`
position: relative;
display: inline-block;
cursor: pointer;
`;
export const AvatarStyled = styled(Avatar)`
width: 200px;
height: 200px;
`;
export const InputStyled = styled.input`
display: none;
`;

View File

@ -1,23 +1,8 @@
import React, { useState } from 'react';
import styled from '@emotion/styled';
import Avatar from "@mui/material/Avatar";
import * as React from 'react';
import { useState } from 'react';
import { AvatarStyled, PhotoStyled, InputStyled } from './index.style';
const PhotoStyled = styled.div`
position: relative;
display: inline-block;
cursor: pointer;
`;
const AvatarStyled = styled(Avatar)`
width: 200px;
height: 200px;
`;
const InputStyled = styled.input`
display: none;
`;
function Photo({ defaultPhoto, onPhotoChange }) {
const Photo = ({ defaultPhoto, onPhotoChange }): React.ReactElement => {
const [photo, setPhoto] = useState(defaultPhoto);
const handleFileChange = (event) => {

View File

@ -0,0 +1,12 @@
import * as React from 'react';;
import Typography from '@mui/material/Typography';
const Title = ({children}): React.ReactElement => {
return (
<Typography component="h1" variant="h5">
{children}
</Typography>
);
}
export default Title;