From 60a88e88fd718fe2b433be197758d383c680e195 Mon Sep 17 00:00:00 2001 From: zainuldeen <78583049+Zain-ul-din@users.noreply.github.com> Date: Sat, 16 Mar 2024 15:24:31 +0500 Subject: [PATCH] feat: updated print table --- src/components/Timetable.tsx | 5 +-- src/components/TimetablePrint.tsx | 59 +++++++++++++++++++------------ src/styles/globals.css | 41 ++++++++++++++------- 3 files changed, 66 insertions(+), 39 deletions(-) diff --git a/src/components/Timetable.tsx b/src/components/Timetable.tsx index 1093cad..5e25f89 100644 --- a/src/components/Timetable.tsx +++ b/src/components/Timetable.tsx @@ -80,10 +80,7 @@ export default function Timetable({ metaData, timetableData }: IProps) { Loading... ) : ( <> -
+
- -
- {payload} + +
+ {payload}
@@ -63,13 +63,19 @@ export default function TimeTablePrint({ })} - + + +
- https://www.lgutimetable.online -
+ + SOURCE: https://www.lgutimetable.online + +
@@ -87,13 +93,18 @@ function TimeTableHead({ titiles }: { titiles: Array }): JSX.Elemen <> - - TIME + + TIME {titiles.map((lectureTime: LectureTime, idx: number): JSX.Element => { return ( - - + + {lectureTime.startTime} {'-'} {lectureTime.endTime} @@ -124,13 +135,13 @@ function TimeTableCell({ return ( <> - - {day} + + {day} {!metaData || metaData.length == 0 ? ( - + All Slots are free @@ -155,11 +166,11 @@ function TimeTableCell({ - + {val.subject ? ( <> @@ -171,11 +182,13 @@ function TimeTableCell({ ':' + `${val.endTime.minutes}`.padEnd(2, '0')} - {val.subject} + + {val.subject} + {val.roomNo} - + {val.teacher} diff --git a/src/styles/globals.css b/src/styles/globals.css index cc05a0b..8090e06 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -251,6 +251,7 @@ a { /* Print Module */ @media print { + table { page-break-after: always !important; } @@ -287,27 +288,43 @@ a { transform-origin: 0 0; color: black !important; } - + * { /* styling */ box-sizing: border-box !important; - font-size: 1rem !important; padding: 3px !important; border-color: black !important; } + + th, td, tr, p, span { + font-size: 1rem !important; + } - .print_timetable { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - display: flex; - justify-content: center; - align-items: center; - border: 1px solid red; + @page{ + background: black; + margin:0; + size: A4; + padding: 0; } + + .print_timetable { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + page-break-inside: avoid; + max-height: 100%; + overflow: hidden; + page-break-after: always; + } + ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 0.1px rgba(0, 0, 0, 0) !important; background-color: #f5f5f500 !important;