-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
160 lines (151 loc) · 4.44 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
window.myDataStore = (() => {
let tab;
return {
setTab(selectedTab) {
tab = selectedTab;
onTabSelected(tab);
},
};
})();
document.addEventListener('DOMContentLoaded', function (event) {
selectTab('home');
myDataStore.setTab('home');
});
function selectTab(tabName) {
const eles = document.getElementsByClassName('nav-item');
for (ele of eles) {
// const ele = eles[index];
ele.classList.remove('selected-nav-item');
}
document.getElementById(tabName).classList.add('selected-nav-item');
myDataStore.setTab(tabName);
}
function getComp(tab) {
switch (tab) {
case 'home':
return Home;
case 'work':
return Work;
case 'contact':
return Contact;
}
}
function onTabSelected(tab) {
document.getElementById('container').innerHTML = getComp(tab);
}
function copyTextToClipboard(text) {
var textArea = document.createElement('textarea');
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
textArea.style.width = '2em';
textArea.style.height = '2em';
textArea.style.padding = 0;
textArea.style.border = 'none';
textArea.style.outline = 'none';
textArea.style.boxShadow = 'none';
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
alert(`Copied "${text}" to clipboard`);
} catch (err) {
console.log('Oops, unable to copy');
}
document.body.removeChild(textArea);
}
const imgUrl = './dp.jpg';
const Home = `
<div id="home-tab">
<img src=${imgUrl} />
<div id="name">asif mohammad</div>
<div id="profession">front-end web developer</div>
<div id="skills">
<span>javascript</span>
<span>react</span>
<span>typescript</span>
<span>redux</span>
<span>recoil</span>
<span>scss</span>
<span class="sec-skill">node.js</span>
<span class="sec-skill">graphql</span>
<span class="sec-skill">vue</span>
</div>
</div>
`;
const Work = `
<div id="work-tab">
<span id="work-title">Professional</span>
<div id="prof-work">
<span class="company">
<span class="company-name">DBS Bank, Hyderabad</span>
<span class="company-desg">Front End Web Developer</span>
<span class="company-time">Sep 2019 - Present</span>
</span>
<span class="company">
<span class="company-name">Oracle, Hyderabad</span>
<span class="company-desg">Software Developer</span>
<span class="company-time">July 2017 - Sep 2019</span>
</span>
</div>
<span id="pers-title">Personal</span>
<div id="pers-work">
<span class="project">
<span class="project-name">BMI Calculator</span>
<span class="project-desc">A simple and slick BMI Calculator</span>
<div class="project-tags">
<span>react</span>
<span>typescript</span>
<span>recoil</span>
<span>scss</span>
</div>
<div class="project-links">
<span class="project-live">
<a target="_blank" href="https://whats-my-bmi.web.app/">
Live
</a>
</span>
<span class="project-code">
<a target="_blank" href="https://github.com/halfdrownedbiscuit/bmi-calculator">
Code
</a>
</span>
</div>
</span>
<span class="project">
<span class="project-name">Portfolio</span>
<span class="project-desc">Professional Portfolio (Current Website)</span>
<div class="project-tags">
<span>html</span>
<span>css</span>
<span>javascript</span>
</div>
<div class="project-links">
<span class="project-code">
<a target="_blank" href="https://github.com/halfdrownedbiscuit/portfolio">
Code
</a>
</span>
</div>
</span>
</div>
</div>
`;
const Contact = `
<div id="contact-tab">
<span class="contact-info">
<img src="raw/email.svg" />
<span>
<a href="mailto:halfdrownedbiscuit@gmail.com">
halfdrownedbiscuit@gmail.com
</a>
</span>
<img class="copy" src="raw/copy.svg" onclick="copyTextToClipboard('halfdrownedbiscuit@gmail.com')"/>
</span>
</div>
`;