-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemp1.html
202 lines (196 loc) · 8.18 KB
/
temp1.html
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
<title>Profile Card Builder</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
background: linear-gradient(to right, #00d2d3, #3a7bd5);
}
.form-card {
width: 400px;
background: white;
border-radius: 10px;
padding: 90px;
border: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
margin: 10px;
}
.profile-card {
width: 400px;
display: flex;
flex-direction: row;
justify-content: 20px;
align-items: center;
width: 50%;
background: white;
border-radius: 20px;
padding: 15px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
margin: 20px;
}
.profile-pic {
width: 200px;
height: 200px;
object-fit: cover;
border-radius: 50%;
}
.profile-info {
flex: 2;
padding: 10px;
border-radius: 8px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.profile-info h2, .profile-info p {
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, sans-serif;
font-style: italic;
font-size: 24px;
color: #333;
}
.form-label {
font-weight: bold;
}
.form-input {
width: 100%;
padding: 10px;
margin: 5px 0;
border: 2px solid #ccc;
border-radius: 4px
}
.form-button {
background: #00d2d3;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
}
.download-button {
background: #00d2d3;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="form-card">
<h2>Profile Card Builder</h2>
<form id="profileForm">
<div >
<label class="form-label" for="photo">Upload Photo or Avatar:</label>
<input type="file" id="photo" accept="image/*" >
</div>
<div>
<label class="form-label" for="name">Name:</label>
<input class="form-input" type="text" id="nameInput" placeholder="Your Name" required>
</div>
<div>
<label class="form-label" for="email">Email:</label>
<input class="form-input" type="email" id="emailInput" placeholder="youremail@example.com" required>
</div>
<div>
<label class="form-label" for="caption">Caption:</label>
<input class="form-input" type="text" id="captionInput" placeholder="Your Caption" required>
</div>
<div>
<label class="form-label" for="instagram">Instagram Username:</label>
<input class="form-input" type="text" id="instagramInput" placeholder="Your Instagram Username" required>
</div>
<div>
<label class="form-label" for="twitter">Twitter Username:</label>
<input class="form-input" type="text" id="twitterInput" placeholder="Your Twitter Username" required>
</div>
<div>
<label class="form-label" for="github">GitHub Username:</label>
<input class="form-input" type="text" id="githubInput" placeholder="Your GitHub Username" required>
</div>
<div>
<label class="form-label" for="portfolio">Portfolio URL:</label>
<input class="form-input" type="url" id="portfolioInput" placeholder="https://www.yourportfolio.com" required>
</div>
<div>
<label class="form-label" for="linkedin">LinkedIn Username:</label>
<input class="form-input" type="text" id="linkedinInput" placeholder="Your LinkedIn Username" required>
</div><br>
<button class="form-button" type="button" id="updateCardButton">Update Card</button>
</form>
</div>
<div class="profile-card">
<img class="profile-pic" id="profilePic" src="default-profile-pic.jpg" alt="Profile Picture">
<div class="profile-info">
<h2 id="name">Your Name</h2>
<p id="email">youremail@example.com</p>
<p id="caption">Your Caption</p>
<p id="instagramUsername">Instagram: Your Username</p>
<p id="twitterUsername">Twitter: Your Username</p>
<p id="githubUsername">GitHub: Your Username</p>
<p id="portfolioUsername">Portfolio: Your Username</p>
<p id="linkedinUsername">LinkedIn: Your Username</p>
</div>
</div>
<div class="btn-download">
<button class="download-button" id="downloadImage">Download as Image</button>
</div><br><br>
<footer style="text-align: center; font-size: small; margin-top: 20px;">
Crafted with love for you ❤️
</footer>
<script>
// Function to update the card content
function updateCard() {
const name = document.getElementById('nameInput').value;
const email = document.getElementById('emailInput').value;
const caption = document.getElementById('captionInput').value;
const instagramUsername = document.getElementById('instagramInput').value;
const twitterUsername = document.getElementById('twitterInput').value;
const githubUsername = document.getElementById('githubInput').value;
const portfolioUsername = document.getElementById('portfolioInput').value;
const linkedinUsername = document.getElementById('linkedinInput').value;
// Update the card content
document.getElementById('name').textContent = name;
document.getElementById('email').textContent = email;
document.getElementById('caption').textContent = caption;
document.getElementById('instagramUsername').textContent = `Instagram: ${instagramUsername}`;
document.getElementById('twitterUsername').textContent = `Twitter: ${twitterUsername}`;
document.getElementById('githubUsername').textContent = `GitHub: ${githubUsername}`;
document.getElementById('portfolioUsername').textContent = `Portfolio: ${portfolioUsername}`;
document.getElementById('linkedinUsername').textContent = `LinkedIn: ${linkedinUsername}`;
// Update profile picture (if a file was selected)
const photoInput = document.getElementById('photo');
if (photoInput.files && photoInput.files[0]) {
const reader = new FileReader();
reader.onload = function (e) {
document.getElementById('profilePic').src = e.target.result;
};
reader.readAsDataURL(photoInput.files[0]);
}
}
// Function to download the card as an image
function downloadCardAsImage() {
const profileCard = document.querySelector('.profile-card');
html2canvas(profileCard).then(function(canvas) {
const link = document.createElement('a');
link.href = canvas.toDataURL('image/png');
link.download = 'profile-card.png';
link.click();
});
}
// Add event listeners to the buttons
document.getElementById('updateCardButton').addEventListener('click', updateCard);
document.getElementById('downloadImage').addEventListener('click', downloadCardAsImage);
</script>
</body>
</html>