Skip to content

Commit abe1f08

Browse files
committed
Add expander / some responsive CSS for smaller screens.
1 parent 9d06c60 commit abe1f08

File tree

1 file changed

+59
-18
lines changed

1 file changed

+59
-18
lines changed

index.html

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
display: flex;
1313
/* Optional: Adds space between the items */
1414
gap: 20px;
15+
16+
@media (width <= 1080px) {
17+
flex-direction: column;
18+
}
1519
}
1620

1721
.column-item {
@@ -22,31 +26,63 @@
2226
background-color: #f0f0f0;
2327
border: 1px solid #ccc;
2428
}
29+
30+
.show {
31+
display: block !important;
32+
}
33+
34+
@media (width >= 1080px) {
35+
.expander {
36+
display: none;
37+
}
38+
.expand-content {
39+
display: block;
40+
}
41+
}
42+
43+
@media (width <= 1080px) {
44+
.expander {
45+
display: block;
46+
}
47+
.expand-content {
48+
display: none;
49+
}
50+
}
2551
</style>
2652
<script type="module">
2753
import {render} from './render.js';
2854

2955
let useButton = false;
3056

3157
document.addEventListener('DOMContentLoaded', () => {
32-
const button = document.querySelector('#load');
58+
// expand interface for raw/complete VC
59+
const expandButton = document.querySelector('#expand-button');
60+
expandButton.addEventListener('click', () => {
61+
const content = document.querySelector('.expand-content');
62+
if(content.classList.contains('show')) {
63+
content.classList.remove('show');
64+
expandButton.textContent = 'Show';
65+
} else {
66+
content.classList.add('show');
67+
expandButton.textContent = 'Hide';
68+
}
69+
});
3370

34-
// skip button if specified
71+
const renderButton = document.querySelector('#render');
72+
const loading = document.querySelector('#loading');
73+
renderButton.addEventListener('click', () => {
74+
renderButton.style.display = 'none';
75+
loading.style.display = 'block';
76+
doRender().catch(() => {});
77+
});
78+
79+
// render immediately if button=false is specified
3580
const searchParams = new URLSearchParams(window.location.search);
3681
useButton = searchParams.get('button') !== 'false';
3782
if(!useButton) {
38-
button.style.display = 'none';
83+
renderButton.style.display = 'none';
3984
doRender().catch(() => {});
40-
return;
4185
}
42-
43-
// use button interface
44-
const loading = document.querySelector('#loading');
45-
button.addEventListener('click', () => {
46-
button.style.display = 'none';
47-
loading.style.display = 'block';
48-
doRender().catch(() => {});
49-
});
5086
});
5187

5288
const credential = {
@@ -184,11 +220,16 @@ <h1>HTML Render Method Test</h1>
184220
<div class="flex-container">
185221
<div class="column-item">
186222
<h2>Raw/Complete Verifiable Credential</h2>
187-
<p>
188-
Below is the "raw" Credential data prior to being selectively disclosed
189-
and rendered by the iframe (to the right):
190-
</p>
191-
<textarea id="fullCredential"></textarea>
223+
<div class="expander">
224+
<button id="expand-button">Show</button>
225+
</div>
226+
<div class="expand-content">
227+
<p>
228+
Below is the "raw" Credential data prior to being selectively disclosed
229+
and rendered by the iframe (to the right):
230+
</p>
231+
<textarea id="fullCredential"></textarea>
232+
</div>
192233
</div>
193234
<div class="column-item">
194235
<h2>Rendered Credential (in a restricted <code>iframe</code>)</h2>
@@ -199,7 +240,7 @@ <h2>Rendered Credential (in a restricted <code>iframe</code>)</h2>
199240
</p>
200241

201242
<div id="display">
202-
<button id="load">
243+
<button id="render">
203244
Render
204245
</button>
205246
<div id="loading" style="display: none">

0 commit comments

Comments
 (0)