Skip to content

Commit e90b844

Browse files
authored
Merge pull request #8 from ChrisJabb21/PC01
Pc01 Complete first issue and moved other UI feature enchancements to separate task issue action items.
2 parents 59cd222 + e5bc31a commit e90b844

6 files changed

Lines changed: 40 additions & 34 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ web_modules/
7474
.cache
7575
.parcel-cache
7676

77+
# MacOS hidden files
78+
.DS_Store
79+
7780
# Next.js build output
7881
.next
7982
out
@@ -137,3 +140,5 @@ dist
137140
# Vite logs files
138141
vite.config.js.timestamp-*
139142
vite.config.ts.timestamp-*
143+
144+
139 KB
Loading

index.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
</head>
88
<script type="module" src="js/index.js"></script>
99
<body>
10-
<h1>Password Generator</h1>
11-
<h2>Generate a strong password with just one click!</h2>
12-
<div class="main">
10+
<h1>PassCraft: Password Generator</h1>
11+
<h2>Generate strong passwords with just one click!</h2>
12+
<div>
1313
<div class="btn-wrapper">
14-
<button class="btn">Generate Password</button>
14+
<button class="btn" id="generateButton">Generate Password</button>
1515
<div class="password-wrapper">
16-
<span class="password"></span>
17-
<button class="copy-btn">Copy</button>
16+
<span class="password" id="output"></span>
1817
</div>
1918
</div>
2019
</div>

js/generate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function generatePassword({
1414
lowerCase = true,
1515
upperCase = true,
1616
digits= true,
17-
symbols = false,
17+
symbols = true,
1818
noLookAlikes = true
1919
}) {
2020
// The sets object defines the character sets for lowercase letters, uppercase letters, digits, and symbols. Each property of the sets object contains a string of characters that belong to that set.

js/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,21 @@ const password = generatePassword({
1111
const characterSetSize = 26 + 26 + 10 + 24; // lowercase + uppercase + digits + symbols
1212
const entropy = estimateEntropyBits(20, characterSetSize);
1313

14+
const button = document.getElementById("generateButton");
15+
const output = document.getElementById("output");
16+
button.addEventListener("click", () => {
17+
const password = generatePassword({
18+
length: 20,
19+
lowerCase: true,
20+
upperCase: true,
21+
digits: true,
22+
symbols: true,
23+
});
24+
const characterSetSize = 26 + 26 + 10 + 24; // lowercase + uppercase + digits + symbols
25+
const entropy = estimateEntropyBits(20, characterSetSize);
1426
console.log("Estimated entropy ");
1527
console.log(`${entropy} bits`);
1628
console.log("Generated password:");
17-
console.log(password);
29+
console.log(password);
30+
output.textContent = password;
31+
});

styles.css

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,23 @@
1-
.main {
2-
margin-top: 100px;
3-
}
41

5-
.search-input {
6-
display: flexwrap;
2+
3+
.btn-wrapper,.password-wrapper, .password {
4+
flex-wrap: wrap;
75
max-width: 100%;
86
margin: 0;
97
margin-left: auto;
108
margin-right: auto;
11-
line-height: 24px;
12-
padding-top: 10px;
13-
padding-bottom: 10px;
14-
padding-left: 30px;
15-
padding-right: 30px;
16-
border: 1px solid #dfe1e5;
17-
border-radius: 24px;
18-
}
19-
20-
.btn-wrapper {
21-
display: flex;
9+
margin-top: 1rem;
10+
margin-bottom: 1rem;
2211
justify-content: center;
2312
}
2413

2514
.btn {
26-
margin-left: 4px;
27-
margin-right: 4px;
28-
margin-top: 30px;
15+
margin: auto;
2916
background: #dfe1e5;
3017
border: none;
31-
padding-top: 8px;
32-
padding-bottom: 8px;
33-
padding-left: 16px;
34-
padding-right: 16px;
3518
border-radius: 4px;
36-
font-size: 14px;
19+
box-shadow: 0 0.25rem 0.25rem rgba(60, 64, 67, .3), 0 2px 6px rgba(60, 64, 67, .15);
20+
font-size: 0.875rem;
3721
}
3822

3923
body {
@@ -42,8 +26,11 @@ body {
4226
width: auto;
4327
margin-left: auto;
4428
margin-right: auto;
45-
display: flexbox;
29+
display: flex;
30+
flex-wrap: wrap;
31+
flex-direction: column;
4632
}
33+
4734
img {
4835
width: 380px;
4936
max-width: 100%;
@@ -57,7 +44,8 @@ a {
5744
}
5845

5946
button, input {
60-
display: flexbox;
47+
display: flex;
48+
flex-wrap: wrap;
6149
max-width: 100%;
6250
border-width: 3px;
6351
border-color: #121212;

0 commit comments

Comments
 (0)