-
Notifications
You must be signed in to change notification settings - Fork 0
/
Projects.js
240 lines (230 loc) · 7.11 KB
/
Projects.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
// ///////////////// email validation /////////////////
const email = document.getElementById('email');
email.addEventListener('input', (event) => {
const text = event.target.value;
if (text !== text.toLowerCase()) {
email.setCustomValidity('Please write email in LowerCase');
} else {
email.setCustomValidity('');
}
});
// ////////////////// Local Storage //////////////////
const form = document.getElementById('form');
let formDataObj;
form.addEventListener('submit', (event) => {
const myFormData = new FormData(event.target);
formDataObj = {};
myFormData.forEach((value, key) => {
formDataObj[key] = value;
});
const formData = JSON.stringify(formDataObj);
localStorage.setItem('Data', formData);
});
const userData = JSON.parse(localStorage.getItem('Data'));
window.onload = () => {
email.value = userData.email;
document.getElementById('text').value = userData.text;
document.getElementById('textarea').value = userData.message;
};
// ///////////// project object //////////////
const projects = [{
id: 1,
card: 'card1',
image: './images/SnapshootPortfolio.svg',
Projectname: 'Tonic',
history: {
proName: 'CANOPY',
tech: 'Backend Dev',
date: 2015,
},
disc: 'A daily selection of privately personalized reads;no accounts or sign-ups required.',
tags: {
html: 'HTML',
css: 'CSS',
javascript: 'JavaScript',
},
button: 'myBtn',
},
{
id: 2,
card: 'card2',
image: './images/multiPostStories.svg',
Projectname: 'Multi-Post',
history: {
proName: 'CANOPY',
tech: 'Backend Dev',
date: 2015,
},
disc: 'A daily selection of privately personalized reads;no accounts or sign-ups required.',
tags: {
html: 'HTML',
css: 'CSS',
javascript: 'JavaScript',
},
button: 'myBtn',
},
{
id: 3,
card: 'card3',
image: './images/SnapshootPortfolio.svg',
Projectname: 'Tonic',
history: {
proName: 'CANOPY',
tech: 'Backend Dev',
date: 2015,
},
disc: 'A daily selection of privately personalized reads;no accounts or sign-ups required.',
tags: {
html: 'HTML',
css: 'CSS',
javascript: 'JavaScript',
},
button: 'myBtn',
},
{
id: 4,
card: 'card4',
image: './images/multiPostStories.svg',
Projectname: 'MultiPost',
history: {
proName: 'CANOPY',
tech: 'Backend Dev',
date: 2015,
},
disc: 'A daily selection of privately personalized reads;no accounts or sign-ups required.',
tags: {
html: 'HTML',
css: 'CSS',
javascript: 'JavaScript',
},
button: 'myBtn',
},
];
const section = document.getElementById('works');
const projectMethod = () => {
projects.map((card) => {
const project = document.createElement('div');
project.classList.add('card_works');
project.classList.add(card.card);
project.innerHTML = `<img
class="card_image "
src=${card.image}
alt="Tonic Project"
/>
<div class="card_detail">
<div class="card_title">
<h2>${card.Projectname}</h2>
<div class="card_history">
<div class="card_history_detail"><p>${card.history.proName}</p></div>
<div>
<img src="./images/Counter.svg" alt="dot" />
</div>
<div class="card_history_detail">
<p>${card.history.tech}</p>
</div>
<div>
<img src="./images/Counter.svg" alt="dot" />
</div>
<div class="card_history_detail"><p>${card.history.date}</p></div>
</div>
</div>
<div class="card_discription">
<p>${card.disc}</p>
</div>
<div class="card_tags">
<div class="tag">
<span class="small">${card.tags.html}</span>
</div>
<div class="tag">
<span class="small">${card.tags.css}</span>
</div>
<div class="tag">
<span class="small">${card.tags.javascript}</span>
</div>
</div>
<div class="card_action">
<button onclick="button(${card.id})" class="btn" id="btn" type="button">See Project</button>
</div>
</div>`;
return section.appendChild(project);
});
};
projectMethod();
const modal = document.getElementById('model');
// eslint-disable-next-line no-unused-vars
function button(id) {
modal.style.display = 'flex';
const card = projects.find((card) => card.id === id);
const project = document.createElement('div');
project.classList.add('modelsection');
project.classList.add(card.card);
project.innerHTML = `<div class="header">
<div>
<h2>${card.Projectname}</h2>
<div class="card_historyy">
<div class="card_history_detaill"><p>${card.history.proName}</p></div>
<div>
<img src="./images/Counter.svg" alt="dot" />
</div>
<div class="card_history_detail">
<p>${card.history.tech}</p>
</div>
<div>
<img src="./images/Counter.svg" alt="dot" />
</div>
<div class="card_history_detail"><p>${card.history.date}</p></div>
</div>
</div>
<a href="#" id="modelcross" class="Menuicon"
><span
id="modelcrossIcon"
style="color: black"
class="material-symbols-outlined"
>
close
</span>
</a>
</div>
<div class="modelimage">
<img
class="card_imagee"
src=${card.image}
alt="Tonic Project"
/>
</div>
<div class="modeldisc">
<div class="card_discription">
<p>
${card.disc}
</p>
</div>
<div class="card_tags">
<div class="modeltags">
<div class="tag">
<span class="small">${card.tags.html}</span>
</div>
<div class="tag">
<span class="small">${card.tags.css}</span>
</div>
<div class="tag">
<span class="small"
>${card.tags.javascript}</span
>
</div>
</div>
<hr class="hr">
<div class="card_action">
<button class="modelbtn" type="button"> See lice <img style="height: 24px; width: 24px; margin-left: 6px;" src="./images/see_live.svg" alt=""></button>
<button class="modelbtn" type="button"> See source <img style="height: 24px; width: 24px; margin-left: 6px;" src="./images/see source.svg" alt=""> </button>
</div>
</div>
</div>`;
modal.appendChild(project);
setTimeout(() => {
const span = document.getElementById('modelcrossIcon');
span.onclick = function shah() {
modal.style.display = 'none';
modal.removeChild(project);
};
}, 50);
}