Skip to content

Commit ea88a15

Browse files
committed
fix: button download curriculo
1 parent 02b9287 commit ea88a15

3 files changed

Lines changed: 39 additions & 11 deletions

File tree

src/index.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,7 @@ <h1 class="highlight">Guilherme Amaral</h1>
132132
</p>
133133
-->
134134

135-
<button type="application/pdf" class="btn-cv" id="abrir-modal">
136-
<i class="fa-solid fa-cloud-arrow-down">
137-
<a href="./GUILHERME-AMARAL-DEV.pdf" download="GUILHERME-AMARAL-DEV.pdf"></a>
138-
</i>
139-
<span class="cv-letra" title="Botão para baixar o currículo em pdf">
140-
Download CV
141-
</span>
142-
</button>
135+
<div id="downloadCvBtn"></div>
143136
<div id="divModal"></div>
144137
</article>
145138
</section>

src/models/Model.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,36 @@ import { scrollSmooth } from '../utils/scrollSmooth';
1919
import { TextTyper } from '../utils/TextTyper';
2020
import { LoaderModel } from './LoaderModel';
2121
import { NavBarModel } from './NavBarModel';
22+
import { DownloadCV } from '../views/DownloadCv';
2223

2324
export class Model {
2425
public render(): void {
2526
const element: HTMLElement | null = document.querySelector('#digit');
2627
const text = 'Desenvolvedor web Full Stack.';
2728
const interval = 100;
2829

30+
const progress = new Progress();
31+
const nav = new NavBarModel();
32+
const downloadCV = new DownloadCV();
33+
const typer = new TextTyper();
34+
2935
LoaderModel.onLoad();
3036

3137
title();
3238

33-
const progress = new Progress();
3439
progress.scroll();
3540

36-
const nav = new NavBarModel();
3741
nav.togleNav();
3842
new ThemeSwitcher();
3943

4044
scrollSmooth();
4145

42-
const typer = new TextTyper();
4346
typer.start(element, text, interval);
4447

4548
// const modal: Modal = new Modal();
4649
// createModal();
4750
// modal.togleModal();
51+
52+
downloadCV.render();
4853
}
4954
}

src/views/DownloadCV.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export class DownloadCV {
2+
private button: HTMLElement | null = document.querySelector('#downloadCvBtn');
3+
private fileUrl: string =
4+
'https://drive.google.com/uc?export=download&id=1PujszdPae5ke5kBYWEQh3CXziPg05Sgn';
5+
6+
private download(): void {
7+
const link = document.createElement('a');
8+
link.href = this.fileUrl;
9+
link.download = 'GUILHERME AMARAL - CV.pdf';
10+
11+
document.body.appendChild(link);
12+
link.click();
13+
document.body.removeChild(link);
14+
}
15+
16+
public render(): void {
17+
if (this.button) {
18+
this.button.innerHTML = `
19+
<button
20+
title="Botão para baixar o currículo em PDF"
21+
type="button"
22+
class="btn-cv"
23+
onclick="${this.download()}">
24+
<i class="fa-solid fa-cloud-arrow-down"></i>
25+
<span class="cv-letra">Download CV</span>
26+
</button>
27+
`;
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)