Skip to content

Commit 1af9e98

Browse files
committed
pdf on web
1 parent 1c422a4 commit 1af9e98

3 files changed

Lines changed: 75 additions & 12 deletions

File tree

resume.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,45 @@ button { font: inherit; }
150150
}
151151
.back-link { display: flex; gap: 10px; align-items: center; }
152152

153+
.pdf-viewer {
154+
width: min(1180px, calc(100vw - 48px));
155+
height: calc(100svh - 108px);
156+
min-height: 680px;
157+
display: none;
158+
flex-direction: column;
159+
margin: 24px auto 32px;
160+
overflow: hidden;
161+
border: 1px solid var(--line);
162+
background: #fff;
163+
box-shadow: 0 45px 100px var(--shadow);
164+
}
165+
.pdf-viewer iframe {
166+
width: 100%;
167+
flex: 1;
168+
border: 0;
169+
background: #fff;
170+
}
171+
.pdf-fallback {
172+
margin: 0;
173+
padding: 10px 16px;
174+
color: #4c504d;
175+
border-top: 1px solid #d7d9d7;
176+
background: #f5f5f3;
177+
font: 400 10px/1.5 var(--mono);
178+
text-align: center;
179+
}
180+
.pdf-fallback a {
181+
color: #12664e;
182+
text-decoration: underline;
183+
text-underline-offset: 2px;
184+
}
185+
html[data-layout="pdf"] .resume-shell {
186+
display: none;
187+
}
188+
html[data-layout="pdf"] .pdf-viewer {
189+
display: flex;
190+
}
191+
153192
.resume-shell {
154193
width: min(1180px, calc(100vw - 48px));
155194
margin: 64px auto;
@@ -662,6 +701,15 @@ html[data-layout="classic"] .resume-footer {
662701
width: 38px;
663702
height: 38px;
664703
}
704+
.pdf-viewer {
705+
width: 100%;
706+
height: calc(100svh - 76px);
707+
min-height: 560px;
708+
margin: 0;
709+
border-right: 0;
710+
border-bottom: 0;
711+
border-left: 0;
712+
}
665713
.resume-shell { width: 100%; margin: 24px 0 0; border-right: 0; border-left: 0; }
666714
.resume-hero { min-height: 620px; padding: 82px 22px 44px; }
667715
.resume-hero > .resume-monogram { top: 30px; left: 22px; }

resume.html

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
try {
2222
document.documentElement.dataset.theme =
2323
localStorage.getItem("resume-theme") || "light";
24+
const savedLayout = localStorage.getItem("resume-layout");
2425
document.documentElement.dataset.layout =
25-
localStorage.getItem("resume-layout") || "modern";
26+
savedLayout === "classic" ? "pdf" : savedLayout || "modern";
2627
} catch {
2728
document.documentElement.dataset.theme = "light";
2829
document.documentElement.dataset.layout = "modern";
@@ -42,9 +43,9 @@
4243
<button
4344
class="layout-toggle"
4445
type="button"
45-
aria-label="Switch to classic résumé layout"
46+
aria-label="View PDF résumé"
4647
aria-pressed="false"
47-
title="Switch résumé layout"
48+
title="View PDF résumé"
4849
>
4950
<span aria-hidden="true">CV</span>
5051
</button>
@@ -69,7 +70,8 @@
6970
</div>
7071
</header>
7172

72-
<main class="resume-shell" id="resume-content">
73+
<div class="resume-views" id="resume-content">
74+
<main class="resume-shell" id="modern-resume">
7375
<header class="resume-hero">
7476
<div class="resume-monogram" aria-hidden="true">TC</div>
7577
<div class="hero-copy">
@@ -401,6 +403,21 @@ <h3>Virtual Career Fair Platform</h3>
401403
<a href="index.html">Return to portfolio ↑</a>
402404
</footer>
403405
</main>
406+
407+
<section class="pdf-viewer" aria-label="PDF résumé viewer">
408+
<iframe
409+
src="assets/Tharuka-Chathura-Resume.pdf#view=FitH"
410+
title="Tharuka Chathura ATS résumé PDF"
411+
></iframe>
412+
<p class="pdf-fallback">
413+
If the PDF does not appear,
414+
<a
415+
href="assets/Tharuka-Chathura-Resume.pdf"
416+
download="Tharuka-Chathura-Resume.pdf"
417+
>download the résumé</a>.
418+
</p>
419+
</section>
420+
</div>
404421
<script src="resume.js"></script>
405422
</body>
406423
</html>

resume.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ function applyTheme(theme) {
1919
applyTheme(root.dataset.theme || "light");
2020

2121
function applyLayout(layout) {
22-
const classic = layout === "classic";
23-
root.dataset.layout = layout;
24-
layoutToggle?.setAttribute("aria-pressed", String(classic));
22+
const pdf = layout === "pdf" || layout === "classic";
23+
root.dataset.layout = pdf ? "pdf" : "modern";
24+
layoutToggle?.setAttribute("aria-pressed", String(pdf));
2525
layoutToggle?.setAttribute(
2626
"aria-label",
27-
classic
28-
? "Switch to modern résumé layout"
29-
: "Switch to classic résumé layout",
27+
pdf ? "View modern résumé" : "View PDF résumé",
3028
);
3129
layoutToggle?.setAttribute(
3230
"title",
33-
classic ? "Use modern layout" : "Use classic résumé layout",
31+
pdf ? "View modern résumé" : "View PDF résumé",
3432
);
3533
}
3634

@@ -47,7 +45,7 @@ themeToggle?.addEventListener("click", () => {
4745
});
4846

4947
layoutToggle?.addEventListener("click", () => {
50-
const nextLayout = root.dataset.layout === "classic" ? "modern" : "classic";
48+
const nextLayout = root.dataset.layout === "pdf" ? "modern" : "pdf";
5149
try {
5250
localStorage.setItem("resume-layout", nextLayout);
5351
} catch {

0 commit comments

Comments
 (0)