Skip to content

Commit 05346ce

Browse files
Updated files to pass checks
1 parent 93f9522 commit 05346ce

File tree

3 files changed

+47
-43
lines changed

3 files changed

+47
-43
lines changed

URL Shortener API Master/css/style.css

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
}
2020

2121
body{
22-
padding: 0rem;
22+
padding: 0;
2323
max-width: 1440px;
2424
margin: auto;
2525
}
@@ -42,7 +42,7 @@ body{
4242
height: 4px;
4343
width: 1.5rem;
4444
background-color: black;
45-
margin: 5px 0px;
45+
margin: 5px 0;
4646
transition: 0.2s;
4747
}
4848

@@ -62,14 +62,14 @@ body{
6262
/* /////////////////////////////////////////// Navlist //////////////////////////////////////////////*/
6363

6464
.navlist{
65-
margin: 0rem auto 0rem 0rem;
65+
margin: 0 auto 0 0;
6666
display: flex;
6767
margin-top: 0;
6868
}
6969

7070
.listItem{
7171
list-style: none;
72-
padding: 0rem 1rem;
72+
padding: 0 1rem;
7373
font-size: 0.9rem;
7474
font-weight: 700;
7575
color: var(--nuetralGray);
@@ -166,25 +166,25 @@ body{
166166
.header{
167167
display: flex;
168168
margin: 2rem 4rem;
169-
padding: 1rem 0rem;
169+
padding: 1rem 0;
170170
}
171171

172172
.content h1{
173173
font-size: 4.8rem;
174174
line-height: 99px;
175-
margin-bottom: 0px;
175+
margin-bottom: 0;
176176
font-weight: 700;
177177
color: var(--veryDarkBlue);
178178
letter-spacing: -4px;
179179
}
180180

181181
.content {
182-
padding: 0rem 4rem;
182+
padding: 0 4rem;
183183
}
184184

185185
.content p{
186186
color: var(--grayishViolet);
187-
padding: 0rem 3rem 0rem 0rem;
187+
padding: 0 3rem 0 0;
188188
font-size: 1.3rem;
189189
}
190190

@@ -194,7 +194,6 @@ body{
194194

195195
.getStarted{
196196
cursor: pointer;
197-
padding: 0.2rem 1.4rem;
198197
margin: 0.3rem;
199198
background-color: var(--primaryCyan);
200199
border-radius: 30px;
@@ -218,7 +217,7 @@ body{
218217
.header{
219218
flex-wrap: wrap-reverse;
220219
justify-content: center;
221-
margin: 2rem 2rem;
220+
margin: 2rem;
222221
}
223222
.illustration{
224223
margin-right: 0;
@@ -233,7 +232,7 @@ body{
233232
width: 20rem;
234233
}
235234
.content{
236-
padding: 0rem;
235+
padding: 0;
237236
}
238237
.content h1{
239238
font-size: 2.7rem;
@@ -247,7 +246,7 @@ body{
247246
/* /////////////////////////////////////////// Shortened Link //////////////////////////////////////////////////////*/
248247

249248
.formContainer{
250-
background-color:rgb(240,241,246);;
249+
background-color:rgb(240,241,246);
251250
display: flex;
252251
justify-content: center;
253252
align-items: center;
@@ -306,7 +305,6 @@ body{
306305
.submit{
307306
position: relative;
308307
cursor: pointer;
309-
padding: 0.2rem 1.4rem;
310308
margin: 0.3rem;
311309
background-color: var(--primaryCyan);
312310
border-radius: 10px;
@@ -352,7 +350,6 @@ body{
352350

353351
.copyLink{
354352
cursor: pointer;
355-
padding: 0.2rem 1.4rem;
356353
margin: 0.3rem;
357354
background-color: var(--primaryCyan);
358355
border-radius: 10px;
@@ -385,27 +382,25 @@ body{
385382

386383
.form{
387384
flex-direction: column;
388-
padding: 1.2rem 0rem;
385+
padding: 1.2rem 0;
389386
margin-left: 0.2rem;
390387
margin-right: 0.2rem;
391388
width: 90%;
392389
}
393390

394391
.wrapper{
395392
position: relative;
396-
}
397-
398-
.wrapper{
399393
flex-direction: column;
400394
}
401395

396+
402397
.wrongLinkText{
403398
bottom: 30%;
404399
}
405400

406401
.submit{
407-
padding: 1rem 0rem;
408-
width: 70%;
402+
padding: 1rem 0;
403+
width: 88%;
409404
}
410405

411406
.shortenedLink{
@@ -414,22 +409,19 @@ body{
414409
}
415410

416411
.linkItems{
417-
margin: 0.3rem 0rem;
412+
margin-top: 0.3rem 0;
418413
}
419414

420415
.copyLink{
421416
width: 100%;
422-
margin: 0.5rem 0rem;
417+
margin: 0.5rem 0;
423418
}
424419

425420
.default{
426421
width: 80%;
427422
margin: 1.4rem;
428423
}
429424

430-
.submit{
431-
width: 88%;
432-
}
433425
.originalLink{
434426
max-width: 300px;
435427
}
@@ -444,7 +436,10 @@ body{
444436
justify-content: center;
445437
flex-direction: column;
446438
text-align: center;
447-
margin: 4rem 0rem 2rem 0rem;
439+
margin-top: 4rem;
440+
margin-right: 0;
441+
margin-bottom: 2rem;
442+
margin-left: 0;
448443
}
449444

450445
.infoContainer h2{
@@ -469,7 +464,7 @@ body{
469464
background-image: url(/images/line.png);
470465
background-position: center;
471466
background-size: contain;
472-
margin: 0rem 2rem;
467+
margin: 0 2rem;
473468
}
474469

475470
.icon{
@@ -487,7 +482,6 @@ body{
487482
.cards{
488483
background-color: white;
489484
padding: 2.5rem 2rem;
490-
width: 20rem;
491485
border-radius: 10px;
492486
margin: 3rem 1rem;
493487
width: 100%;
@@ -531,7 +525,7 @@ body{
531525
align-items: center;
532526
justify-content: center;
533527
flex-direction: column;
534-
margin: 3rem 0rem;
528+
margin: 3rem 0;
535529
}
536530

537531
}
@@ -544,7 +538,7 @@ body{
544538
background-image: url(/images/verticalLineMobile.png);
545539
background-size:contain;
546540
background-repeat: no-repeat;
547-
background-position-x: 0px;
541+
background-position-x: 0;
548542
}
549543

550544
}
@@ -567,7 +561,10 @@ body{
567561
}
568562

569563
.advert .getStarted{
570-
margin: 0.6rem 0rem 2.2rem 0rem ;
564+
margin-top: 0.6rem;
565+
margin-right: 0;
566+
margin-bottom: 2.2rem;
567+
margin-left: 0;
571568
}
572569

573570
/* Media Query for handling advert */
@@ -576,7 +573,10 @@ body{
576573
.advert h2{
577574
text-align: center;
578575
font-size: 1.5rem;
579-
margin: 5rem 0rem 0rem 0rem;
576+
margin-top: 5rem;
577+
margin-bottom: 0;
578+
margin-left: 0;
579+
margin-right: 0;
580580
}
581581

582582
.advert .getStarted{
@@ -653,7 +653,7 @@ body{
653653
}
654654

655655
.footerList{
656-
padding: 0rem 3rem;
656+
padding: 0 3rem;
657657
}
658658
}
659659

@@ -668,7 +668,7 @@ body{
668668

669669
.fListItem:first-child{
670670
font-weight: 700;
671-
margin: 2rem 0rem;
671+
margin: 2rem 0;
672672
}
673673

674674

URL Shortener API Master/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div class="logo">
2727
<img src="images/logo.svg" alt="">
2828
</div>
29-
<div class="hamburgerIcon" onclick="handler(this)">
29+
<div class="hamburgerIcon">
3030
<p class="bar1"></p>
3131
<p class="bar2"></p>
3232
<p class="bar3"></p>

URL Shortener API Master/js/app.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
//To do -
2-
// 1. To make the error message on empty link
3-
4-
1+
//Running the generate element function to generate all the shortened links stored in local storage
52
generateElement();
63

7-
//Function to trigger hamburger Icon
8-
function handler(element){
4+
document.querySelector('.hamburgerIcon').addEventListener('click',()=>{
95
element.classList.toggle('change');
106
let navbar = document.querySelector('.navbar');
117
navbar.classList.toggle('show');
12-
}
8+
});
139

1410
//Function to handle form submission
1511
let shortenBtn = document.getElementById('shorten');
@@ -89,7 +85,7 @@ function generateElement(){
8985
html+=`<div class="shortenedLink">
9086
<a href="${shortenedLinksArray[i].opLink}" class="originalLink linkItems" target="__blank">${shortenedLinksArray[i].opLink}</a>
9187
<a href="${shortenedLinksArray[i].shortLink}" class="shortened linkItems" target="__blank">${shortenedLinksArray[i].shortLink}</a>
92-
<button class="copyLink linkItems" onclick="copyShortenedLink(this.parentElement,this)">Copy</button>
88+
<button class="copyLink linkItems">Copy</button>
9389
</div>`
9490
}
9591
document.querySelector('.linksContainer').innerHTML = html;
@@ -108,6 +104,14 @@ function clipboard(linkToBeCopied){
108104
document.body.removeChild(textArea);
109105
}
110106

107+
//Function to add event listener to copy links button
108+
document.body.addEventListener('click',function(event){
109+
let target = event.target;
110+
if(target.nodeName === "BUTTON" && /copyLink/.test(target.className)){
111+
copyShortenedLink(target.parentElement,target);
112+
}
113+
})
114+
111115
//Function to handle copy and paste operations
112116
function copyShortenedLink(parentElement,element){
113117
let shortenedLink = parentElement.childNodes[3].innerText;

0 commit comments

Comments
 (0)