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

Add styles to support printing the tutorial #771

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 components/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Link from "next/link";
function Footer({ next, prev, mdPath }) {
let edit = `https://github.com/tokio-rs/website/edit/master/content/${mdPath}`;
return (
<div className="tk-doc-footer">
<div className="tk-doc-footer is-hidden-print">
<div className="level">
<div className="level-left">
<div className="level-item tk-prev">
Expand Down Expand Up @@ -98,7 +98,7 @@ function TableOfContents({ headings }) {
}, [headings]);

return (
<aside className="column is-one-third tk-content-summary">
<aside className="column is-one-third tk-content-summary is-hidden-print">
<ul className="tk-content-summary-menu">{list}</ul>
</aside>
);
Expand Down Expand Up @@ -134,7 +134,7 @@ export default function Content({
return (
<>
<div className="columns is-marginless tk-docs">
<div className="column is-one-quarter tk-docs-nav">
<div className="column is-one-quarter tk-docs-nav is-hidden-print">
<Menu href={href} menu={menu}>
{isBlogRoute && (
<div className="all-posts-link">
Expand Down
2 changes: 1 addition & 1 deletion components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const Navigation: FC<{ blog: Blog }> = ({ blog }) => {

return (
<nav
className="navbar is-spaced"
className="navbar is-spaced is-hidden-print"
role="navigation"
aria-label="main navigation"
>
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"@next/font": "^13.1.1",
"bulma": "^0.8.2",
"bulma-print": "^1.0.1",
"classnames": "^2.3.1",
"glob": "^7.1.7",
"gray-matter": "^4.0.3",
Expand Down
24 changes: 24 additions & 0 deletions styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ $footer-background-color: black;
$footer-color: white;

@import "../node_modules/bulma/bulma.sass";
@import "../node_modules/bulma-print/bulma-print";

// Darken colors
@function darken($color) {
Expand Down Expand Up @@ -511,6 +512,29 @@ a:active {
}
}

@media print {
.columns {
display: block !important;
margin: 0 !important;
}
.tk-content,
.tk-markdown {
width: 100% !important;
padding: 0 !important;
}
.section {
padding: 0 !important;
}
body {
margin: revert !important;
}
pre {
white-space: pre-wrap !important;
overflow-wrap: break-word !important;
break-inside: avoid !important;
}
}

.tk-docs {
.tk-docs-nav {
background-color: $light-gray;
Expand Down