Skip to content

Commit

Permalink
bodge to fix screenshots on mobile (smol screens)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelcmtd committed Jul 15, 2024
1 parent 441a52b commit 345dde7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": "stylelint-config-standard"
"extends": "stylelint-config-standard",
"rules": {
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["global"]
}
]
}
}
4 changes: 2 additions & 2 deletions src/components/KinkCheck.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
}

@media screen and (width <= 800px) {
.category,
.table {
:global(body:not(.screenshot)) .category,
:global(body:not(.screenshot)) .table {
width: 100%;
}
}
2 changes: 1 addition & 1 deletion src/components/RatingOverview.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Rater from "./Rater";
font-size: 16pt;
}
@media screen and (width <= 800px) {
div {
:global(body:not(.screenshot)) div {
justify-content: space-between;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/ScreenshotButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function ScreenshotButton({ title, options = {} }: { title: strin
<a onClick={async () => {
// TODO: be able to pass in a selector for what to screenshot
const content = document.querySelector("div#content") as HTMLElement;
document.body.classList.add("screenshot");
content.style.width = options.windowWidth + "px";
const canvas = await html2canvas(content, {
backgroundColor: "black",
Expand All @@ -16,6 +17,7 @@ export default function ScreenshotButton({ title, options = {} }: { title: strin
scale: window.orientation !== undefined ? 1 : 2,
...options
});
document.body.classList.remove("screenshot");
content.style.width = "";

const date = new Date().toISOString()
Expand Down

0 comments on commit 345dde7

Please sign in to comment.