File size: 3,305 Bytes
efaae49 |
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 |
<!DOCTYPE html>
<html>
<head>
{%if is_space %}
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
{% endif %}
<style>
/* Reset some default styles */
body, h1, h2, h3, p, ul {
margin: 0;
padding: 0;
}
body {
font-family: 'Arial', sans-serif;
overflow-y: hidden;
}
.sidebar {
position: absolute;
top: 0;
left: 0;
height: 100vh;
max-height: calc(100vh - 50px);
width: 300px;
overflow-y: scroll;
overflow-x: hidden;
font-size: 0.875rem; /* 14px */
line-height: 1.25rem; /* 20px */
transition: width 0.3s ease;
}
.sidebar.collapsed {
width: 0;
}
.sidebar a {
display: block;
padding: 8px 16px;
text-decoration: none;
color: rgb(107 114 128);
}
.sidebar a:hover {
color: black;
transform: translateX(1px);
}
/* Apply a different style to the selected item in the sidebar */
.sidebar a.active {
background-color: rgb(251 146 60);
color: white;
border-radius: 0.75rem;
font-weight: bold;
}
/* Styling for the close button */
.close-btn {
cursor: pointer;
border: none;
background-color: white;
font-size: xx-large;
position: relative;
}
/* Styling for the content */
.content {
margin-left: 300px;
padding: 20px;
display: block;
height: 100vh;
transition: margin-left 0.3s ease;
}
.content.collapsed {
margin-left: 0;
}
/* Make the iframe responsive */
.content iframe {
width: 100%;
border: 0;
height: 100%;
}
@media only screen and (max-width: 600px) {
/* Adjust styles for smaller screens */
.sidebar {
width: 100%;
position: relative;
height: auto;
}
.content {
margin-left: 0;
}
}
</style>
<script src="//unpkg.com/alpinejs" defer></script>
</head>
<body x-data="{ current_demo: '{{ initial_demo }}', is_collapsed: false }">
<div style="display: flex; flex-direction: column;">
<div>
<button @click="is_collapsed = !is_collapsed" class="close-btn">
<a x-text="is_collapsed ? '➡️' : '⬅️'"></a>
</button>
</div>
<div :class="{ 'sidebar': true, 'collapsed': is_collapsed }" style="margin-top: 50px;">
{% for name in names %}
<a @click="current_demo = '{{ name[0] }}'" :class="current_demo == '{{ name[0] }}' ? 'active' : ''">{{ name[0] }} {% if name[1] %}❌{% endif %}</a>
{% endfor %}
</div>
</div>
<div :class="{ 'content': true, 'collapsed': is_collapsed }">
<iframe :src="`/demo/${current_demo}${document.location.search}`"></iframe>
</div>
</body>
</html> |