From 021031ced793d87813c6fb959d47d34efc2161bc Mon Sep 17 00:00:00 2001 From: Primakov Alexandr Alexandrovich Date: Wed, 6 Nov 2024 13:03:55 +0300 Subject: [PATCH] short lesson name --- src/pages/attendance/attendance.tsx | 37 ++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/pages/attendance/attendance.tsx b/src/pages/attendance/attendance.tsx index 2b20909..bc74054 100644 --- a/src/pages/attendance/attendance.tsx +++ b/src/pages/attendance/attendance.tsx @@ -1,11 +1,10 @@ import React, { useMemo } from 'react' import { useParams } from 'react-router-dom' -import styled from '@emotion/styled' +import { Box, Heading, Tooltip, Text } from '@chakra-ui/react' +import dayjs from 'dayjs' import { api } from '../../__data__/api/api' import { PageLoader } from '../../components/page-loader/page-loader' -import { Box, Container, Heading } from '@chakra-ui/react' -import dayjs from 'dayjs' export const Attendance = () => { const { courseId } = useParams() @@ -69,14 +68,22 @@ export const Attendance = () => { {attendance.map((lesson, index) => ( {dayjs(lesson.date).format('DD.MM.YYYY')} - {lesson.name} + {} + {data.students.map((st) => { const wasThere = lesson.students.findIndex((u) => u.sub === st.sub) !== -1 - return {wasThere ? '+' : '-'} + return ( + + {wasThere ? '+' : '-'} + + ) })} ))} @@ -86,3 +93,17 @@ export const Attendance = () => { ) } + +const ShortText = ({ text }: { text: string }) => { + const needShortText = text.length > 20 + + if (needShortText) { + return ( + + {text.slice(0, 20)}... + + ) + } + + return text +}