JSFiddle - React, Tailwind, and code Playground
by der_robert
HTML
<div class="container" style="display: grid; grid-template-columns: 250px 1fr; gap: 20px; height: 70vh;">
<!-- Linke Spalte (Ordner) -->
<div class="folder-pane" style="display: grid; grid-template-rows: auto 1fr auto; border-right: 1px solid #e0e0e0;">
<!-- Header -->
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 10px;">
<div style="font-weight: 600;">Ordner</div>
<button id="toggle-fullscreen" style="background: none; border: none; cursor: pointer;">
${isFullscreen ? '🔲' : '🔳'}
</button>
</div>
<!-- Scrollbarer Bereich für Ordner -->
<div style="overflow-y: auto; padding: 0 10px;">
<ul id="folders" style="list-style: none; padding: 0; margin: 0;">
<li data-path="/root">Root (3)</li>
<ul>
<li data-path="/root/ordner1">Ordner 1 (2)</li>
<li data-path="/root/ordner2">Ordner 2 (5)</li>
<ul>
<li data-path="/root/ordner2/unterordner1">Unterordner 1 (1)</li>
</ul>
<li data-path="/root/ordner3">Ordner 3 (0)</li>
</ul>
</ul>
</div>
<!-- Button "Neuer Ordner" (außerhalb des scrollbaren Bereichs) -->
<div style="padding: 10px; border-top: 1px solid #e0e0e0;">
<button id="create-folder-button" style="width: 100%; padding: 8px; background: #f0f0f0; border: 1px solid #ddd; cursor: pointer;">
+ Neuer Ordner
</button>
</div>
</div>
<!-- Rechte Spalte (Bilder) -->
<div class="file-pane" style="display:...
CSS
/* Container für das gesamte Modal */
.container {
display: grid;
grid-template-columns: 250px 1fr; /* Linke Spalte: 250px, Rechte Spalte: restlicher Platz */
gap: 20px; /* Abstand zwischen den Spalten */
height: 70vh; /* Höhe des Modals */
}
/* Linke Spalte (Ordner) */
.folder-pane {
display: grid;
grid-template-rows: auto 1fr auto; /* Header, scrollbarer Bereich, Button */
border-right: 1px solid #e0e0e0; /* Trennlinie zwischen den Spalten */
}
/* Rechte Spalte (Bilder) */
.file-pane {
display: grid;
grid-template-rows: auto 1fr auto; /* Header, scrollbarer Bereich, Button */
}
/* Scrollbare Bereiche */
.folder-pane > div:nth-child(2),
.file-pane > div:nth-child(2) {
overflow-y: auto; /* Scrollbarer Bereich */
padding: 0 10px; /* Innenabstand */
}
/* Buttons außerhalb des scrollbaren Bereichs */
.folder-pane > div:last-child,
.file-pane > div:last-child {
padding: 10px;
border-top: 1px solid #e0e0e0; /* Trennlinie */
}
/* Stile für die Ordnerliste */
#folders, #folders ul {
list-style: none;
padding-left: 0;
margin: 0;
}
#folders ul {
padding-left: 20px; /* Einrückung für Unterordner */
}
#folders li {
padding: 8px 12px;
margin: 2px 0;
cursor: pointer;
transition: background 0.2s;
border-radius: 4px;
background: #f9f9f9;
border: 1px solid #e0e0e0;
}
#folders li:hover {
background: #e3f2fd;
border-color: #42a5f5;
}
#folders li.active {
background: #e3f2fd;
border-color: #42a5f5;
}
/* Stile für die Bilderliste */
#image-picker-container img {
width: 100%;
height: 120px;
object-fit: cover;
border-radius: 4px;
border: 2px solid transparent;
transition: all 0.2s;
cursor: pointer;
}
#image-picker-container img:hover {
border-color: #42a5f5;
transform: translateY(-2px);
box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}