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

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