Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print styling #504

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ let App = () => {
const [isPrintView, setIsPrintView] = useState(false)
const [printViewCaptureFirstSection, setPrintViewCaptureFirstSection] = useState(true)

useEffect(() => {
document.body.className = isPrintView ? 'print-view' : ''
}, [isPrintView])
// useEffect(() => {
// document.body.className = isPrintView ? 'print-view' : ''
// }, [isPrintView])

// const state = {
// timeZone, year, session, sessions, timetableData, modules, selectedModules, weekStart, darkMode,
Expand Down
2 changes: 1 addition & 1 deletion src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default function Calendar({ timetableData, selectedModules, session, year
bootstrapFontAwesome={false}
// expandRows={true}
// can't apply in print context because FC events need JS to resize (CSS inset prop)
viewClassNames={isPrintView ? 'print-view' : ''}
// viewClassNames={isPrintView ? 'print-view' : ''}
height='100%'
expandRows={true}

Expand Down
32 changes: 20 additions & 12 deletions src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -307,24 +307,32 @@ body[data-theme="dark"] {
}
}

// print formatting - designed for calendar.current
.print-view {
@page {
size: landscape;
}

// Print formatting
@page {
size: landscape;
margin: 0;
}
// designed for calendar.current
// .print-view {
@media print {
body {
print-color-adjust: exact;
-webkit-print-color-adjust: exact;
}

// A4 Sheet
.fc-view-harness {
flex-grow: 0 !important; // override FullCalendar css
height: 21cm;
width: 29.7cm;
font-size: 12pt;
// Assumes A4; will look tiny for larger paper sizes
.fc {
zoom: 0.7;
}

// A4 Sheet
// .fc-view-harness {
// flex-grow: 0 !important; // override FullCalendar css
// height: 21cm;
// width: 29.7cm;
// font-size: 12pt;
// }

button {
visibility: hidden;
}
Expand Down
Loading