Skip to content

Commit 4efa5b1

Browse files
committed
TaskSolution: исправление стилей
1 parent f14f8ab commit 4efa5b1

1 file changed

Lines changed: 43 additions & 48 deletions

File tree

hwproj.front/src/components/Solutions/TaskSolutionComponent.tsx

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import {FC, useEffect, useState} from 'react';
3-
import {Button, CircularProgress, Grid, TextField, Typography} from "@material-ui/core";
3+
import {Button, CircularProgress, Grid, Typography} from "@material-ui/core";
44
import CheckCircleOutlineIcon from "@material-ui/icons/CheckCircleOutline";
55
import Link from '@material-ui/core/Link'
66
import './style.css'
@@ -23,7 +23,7 @@ import {
2323
CardActions,
2424
IconButton,
2525
Chip,
26-
Box
26+
Box, TextField
2727
} from "@mui/material";
2828
import AvatarUtils from "../Utils/AvatarUtils";
2929
import Utils from "../../services/Utils";
@@ -428,11 +428,8 @@ const TaskSolutionComponent: FC<ISolutionProps> = (props) => {
428428
}
429429
style={{
430430
color: "#3f51b5",
431-
paddingLeft: 0,
432-
paddingRight: 0,
433431
textTransform: "uppercase",
434432
fontWeight: 500,
435-
marginBottom: 8,
436433
fontSize: "0.95rem",
437434
}}
438435
>
@@ -530,48 +527,46 @@ const TaskSolutionComponent: FC<ISolutionProps> = (props) => {
530527
);
531528

532529
return (
533-
<Grid container item direction="row" spacing={1} alignItems="center">
534-
<Grid item>
535-
{isEditable ? (
536-
<TextField
537-
style={{width: 100}}
538-
required
539-
label="Баллы"
540-
variant="outlined"
541-
margin="normal"
542-
type="number"
543-
fullWidth
544-
InputProps={{
545-
readOnly: hasCriteria || !props.forMentor || !state.clickedForRate,
546-
inputProps: {min: 0, value: points},
547-
}}
548-
size="small"
549-
onChange={(e) => {
550-
if (hasCriteria) return;
551-
552-
e.persist();
553-
setState(prevState => ({
554-
...prevState,
555-
points: +e.target.value,
556-
}));
557-
}}
558-
onClick={() => {
559-
if (isRated) return;
560-
setState(prevState => ({
561-
...prevState,
562-
clickedForRate: props.forMentor,
563-
}));
564-
}}
565-
/>
566-
) : (
567-
<Chip
568-
label={<Typography variant="h6">{points}</Typography>}
569-
size="medium"
570-
/>
571-
)}
572-
</Grid>
573-
<Grid item>{` / ${maxRating}`}</Grid>
574-
</Grid>
530+
<Stack direction="row" spacing={1} alignItems={"baseline"}>
531+
{isEditable ? (
532+
<TextField
533+
style={{width: 100}}
534+
required
535+
label="Баллы"
536+
variant="standard"
537+
margin="normal"
538+
type="number"
539+
fullWidth
540+
InputProps={{
541+
readOnly: hasCriteria || !props.forMentor || !state.clickedForRate,
542+
inputProps: {min: 0, value: points},
543+
}}
544+
size="small"
545+
onChange={(e) => {
546+
if (hasCriteria) return;
547+
548+
e.persist();
549+
setState(prevState => ({
550+
...prevState,
551+
points: +e.target.value,
552+
}));
553+
}}
554+
onClick={() => {
555+
if (isRated) return;
556+
setState(prevState => ({
557+
...prevState,
558+
clickedForRate: props.forMentor,
559+
}));
560+
}}
561+
/>
562+
) : (
563+
<Chip
564+
label={<Typography variant="h6">{points}</Typography>}
565+
size="medium"
566+
/>
567+
)}
568+
<div>{` / ${maxRating}`}</div>
569+
</Stack>
575570
);
576571
};
577572

@@ -847,7 +842,7 @@ const TaskSolutionComponent: FC<ISolutionProps> = (props) => {
847842
color,
848843
}}
849844
>
850-
<CardContent style={{paddingBottom: 5, marginBottom: 0}}>
845+
<CardContent>
851846
<Grid container direction={"column"} spacing={1}>
852847
{(!hasCriteria || !state.clickedForRate) && <Grid item>
853848
{renderRateInput()}

0 commit comments

Comments
 (0)