Skip to content

Commit 3c4bc95

Browse files
committed
add clear buttons
1 parent ea127fc commit 3c4bc95

File tree

3 files changed

+73
-3
lines changed

3 files changed

+73
-3
lines changed

index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,21 @@ <h1>MetaMask State Diff</h1>
1818
</div>
1919
<div>
2020
<h2>State A</h2>
21-
<textarea id="input1" placeholder="Paste MetaMask state here..."></textarea>
21+
<div class="input-container">
22+
<textarea id="input1" placeholder="Paste MetaMask state here..."></textarea>
23+
<button onclick="clearInput('input1')" class="clear-button">Clear State</button>
24+
</div>
2225
</div>
2326
<div>
2427
<h2>State B</h2>
25-
<textarea id="input2" placeholder="Paste MetaMask state here..."></textarea>
28+
<div class="input-container">
29+
<textarea id="input2" placeholder="Paste MetaMask state here..."></textarea>
30+
<button onclick="clearInput('input2')" class="clear-button">Clear State</button>
31+
</div>
2632
</div>
2733
<div class="btn">
2834
<button onclick="showDiff()">Show Differences</button>
35+
<button onclick="clearAll()" class="clear-all-button">Clear All</button>
2936
</div>
3037
<h2>Controllers Differences</h2>
3138
<div class="diff-container">

script.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,15 @@ function showTooltip(event) {
256256
setTimeout(() => {
257257
tooltip.remove();
258258
}, 1000);
259+
}
260+
261+
function clearInput(inputId) {
262+
document.getElementById(inputId).value = '';
263+
}
264+
265+
function clearAll() {
266+
document.getElementById('input1').value = '';
267+
document.getElementById('input2').value = '';
268+
document.getElementById('diffOutput1').innerHTML = '';
269+
document.getElementById('diffOutput2').innerHTML = '';
259270
}

styles.css

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ button {
9292
}
9393

9494
.updated {
95-
background-color: #fff95b;
95+
background-color: #FFA500;
96+
color: #333333;
9697
}
9798

9899
.equal {
@@ -101,4 +102,55 @@ button {
101102

102103
.controller-content div {
103104
margin-left: 20px;
105+
}
106+
107+
.input-container {
108+
display: flex;
109+
flex-direction: column;
110+
gap: 10px;
111+
align-items: flex-start;
112+
}
113+
114+
.clear-button {
115+
padding: 5px 10px;
116+
background-color: #ff4444;
117+
color: white;
118+
border: none;
119+
border-radius: 4px;
120+
cursor: pointer;
121+
}
122+
123+
.clear-button:hover {
124+
background-color: #cc0000;
125+
}
126+
127+
.clear-all-button {
128+
margin-left: 10px;
129+
padding: 8px 16px;
130+
background-color: #ff4444;
131+
color: white;
132+
border: none;
133+
border-radius: 4px;
134+
cursor: pointer;
135+
}
136+
137+
.clear-all-button:hover {
138+
background-color: #cc0000;
139+
}
140+
141+
.btn button {
142+
padding: 8px 16px;
143+
border: none;
144+
border-radius: 4px;
145+
cursor: pointer;
146+
font-size: 1em;
147+
}
148+
149+
.btn button:first-child {
150+
background-color: #FFA500; /* Yellow-orange color for the Show Differences button */
151+
color: white;
152+
}
153+
154+
.btn button:first-child:hover {
155+
background-color: #FF8C00; /* Darker yellow-orange on hover */
104156
}

0 commit comments

Comments
 (0)