Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added dark mode, changed layout, updated upload file btn,fix the issss #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 44 additions & 24 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="gdsc-icon.png">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-skAcpIdS7UcVUC05LJ9Dxay8AXcDYfBJqt1CJ85S/CFujBsIzCIv+l9liuYLaMQ/" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-skAcpIdS7UcVUC05LJ9Dxay8AXcDYfBJqt1CJ85S/CFujBsIzCIv+l9liuYLaMQ/"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
Expand All @@ -16,44 +22,58 @@

<title>Badge Generator</title>
</head>

<body>
<div id="wrapper" class="container">
<div class="row justify-content-center align-items-center" id="card-wrapper">
<div id="card">
<div class="row justify-content-center align-items-center card-wrapper">
<div id="card" class="card">
<img id="photo" src="">

<div id="gdsc-branding">
<!-- <h4 id="name">Supratik Chakraborty</h4><hr> -->
<img id="gdsc-logo"src="assets/gdsc.png"><hr>
<img id="gdsc-logo" src="assets/gdsc.png">
<hr>
<p id="name">Name</p>
</div>
</div>
</div>
<br><br>



<form>
<div class="form-group">
<label for="inputname">Name</label>
<input id="inputname" class="form-control" type="text" placeholder="Enter Name" required onchange=loadName(event)>
<small id="namehelp" class="form-text text-muted">Please provide your full name as it will appear on your badge.</small>
<br><br>
<label for="inputname">Name</label>
<input id="inputname" class="form-control" type="text" placeholder="Enter Name" required
onchange=loadName(event)>
<small id="namehelp" class="form-text text-muted">Please provide your full name as it will appear on
your badge.</small>
<br><br>

</div>


<div class="form-group">
<label for="inputphoto">Photo</label>
<input id="inputphoto" class="form-control" type="file" placeholder="Enter your photo" required onchange=loadFile(event)>
<small id="photohelp" class="form-text text-muted">Please provide a photograph of yourself in JPEG or PNG formats.</small>
<br><br>
<div class="form-group file-upload-div">
<!-- <label for="inputphoto">Photo</label> -->
<input id="inputphoto" class="file" type="file" title="" required
onchange=loadFile(event)>
<small id="photohelp" class="form-text text-muted">Please provide a photograph of yourself in JPEG or
PNG formats.</small>
<br><br>
</div>
</form>
<div class="text-center mb-3">
<button class="btn btn-block btn-primary" type="submit" onclick="downloadImg()">Download Your GDSC Badge</button>
</div>
</div>

</div>
<div class="text-center mb-2">
<button class="btn btn-block btn-primary download-btn" type="submit" onclick="downloadImg()">Download GDSC Badge</button>
</div>
<div class="darkMode-toggle" onclick="darkMode()"><svg xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-moon" width="48" height="48" viewBox="0 0 24 24" stroke-width="1.5"
stroke="#fff" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
</svg></div>
<script src="main.js"></script>
</body>
</html>

</html>
20 changes: 20 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
let downloadBtn=document.getElementsByClassName('download-btn')[0]
var loadFile = (event) => {
let image = document.getElementById('photo');
image.src = URL.createObjectURL(event.target.files[0]);
downloadBtn.style.display="inline-block"
};

var loadName = (event) => {
let name = document.getElementById("name");
name.innerHTML = event.target.value;
}

var darkMode=()=>{
let body=document.querySelector('body')
let dark=document.querySelector('.darkMode-toggle')
body.classList.toggle('body-darkMode')
if (body.classList.contains('body-darkMode')) {
dark.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-sun" width="48" height="48" viewBox="0 0 24 24" stroke-width="1.5" stroke="#000000" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<circle cx="12" cy="12" r="4" />
<path d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7" />
</svg>`
}
else{
dark.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-moon" width="48" height="48" viewBox="0 0 24 24" stroke-width="1.5" stroke="#fff" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
</svg>`
}
}



Expand Down
110 changes: 103 additions & 7 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@
body {
font-family: 'Open sans', sans-serif;
}
#wrapper {
/* padding-top: 40px; */
height: 90vh;
display: flex;
justify-content: space-evenly;
align-items: center;
overflow: auto;
}

#card-wrapper {
text-align: center;
.card-wrapper {
text-align: center;
margin-left: 10px;
margin-right: 10px;
}
#card {
.card {
padding: 0px;
/* height: 400px; */
max-width: 400px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
box-shadow: 0 4px 8px 0 rgba(134, 99, 99, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border-top: 1px solid rgba(153, 153, 153,.5) ;
border-radius: 10px;
background: transparent;
}

#gdsc-branding {
Expand All @@ -27,14 +36,55 @@ body {
#photo {
background: linear-gradient(rgb(228, 228, 228), rgb(170, 170, 170));
width: 100%;
max-height: 400px;
/* height: 320px; */
border-radius: 10px 10px 0px 0px;
}

#wrapper {
padding-top: 40px;
.file-upload-div{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.file{
position: relative;
width: 120px;
border-radius: 10px;
cursor: pointer;
transition: .2s;
}
.file::-webkit-file-upload-button{
visibility: hidden;
}
.file::before{
position: absolute;
content: 'Upload photo';
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: rgb(245, 245, 245);
background: linear-gradient(rgb(132, 0, 255),rgb(110, 110, 252));
}
.file::after{
position:absolute;
content: '';
left: 0;
bottom: 0;
background: rgba(159, 161, 255, 0.753);
height: 5px;
width: 100%;
}
.file:hover::after{
background: transparent;
}
.file:hover{
transform: translateY(3px);
}

p {
/* font-weight: bold; */
color: #666D74;
Expand All @@ -45,8 +95,54 @@ p {
width: 100%;
margin: 0px;
}
#name{
font-size:clamp(15px, 4vw,22px);

}
input {
margin-top: 10px;
padding: 10px;
}
.download-btn{
display: none;
box-shadow: 0 4px 6px rgba(105, 182, 255, 0.997);
}
.darkMode-toggle{
position: absolute;
top: 5px;
right: 5px;
transform: scale(.6);
border-radius: 50%;
background-color: #363636;
padding: 5px;
cursor: pointer;
}

.body-darkMode{
background: #252525;
}

.body-darkMode .darkMode-toggle{
background: #d6d6d6;
}
.body-darkMode .card{
box-shadow: 0 20px 0px 5px rgba(255, 255, 255, 0.173);
}
.body-darkMode #gdsc-logo{
filter:brightness(160%);
}

.body-darkMode label{
color:rgba(153, 153, 153, 0.767) ;
}
::-webkit-scrollbar{
width: 0;
}
@media screen and (max-width:1000px) {
#wrapper {
/* height: 80vh; */
padding-top: 60px;
display: block;

}
}