<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Kanban Board</title>
<!-- SortableJS CDN -->
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<!-- Optional Tailwind CSS CDN -->
<!-- <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> -->
<style>
/* Basic Custom CSS Fallback (or primary styling if not using Tailwind) */
body {
font-family: sans-serif;
margin: 0;
padding: 20px;
background-color: #f4f7f9;
}
.kanban-board {
display: flex;
gap: 20px;
max-width: 1200px;
margin: 20px auto;
}
.kanban-column {
background-color: #e2e8f0; /* Light gray column background */
border-radius: 8px;
padding: 15px;
width: 300px;
min-height: 200px; /* Ensure columns have some initial height */
display: flex;
flex-direction: column;
}
.kanban-column-title {
font-weight: bold;
font-size: 1.2em;
margin-bottom: 10px;
text-align: center;
}
.kanban-items {
min-height: 50px; /* Min height for item container */
}
.kanban-item {
background-color: white;
padding: 10px 15px;
border: 1px solid #ddd;
border-radius: 4px;
margin-bottom: 8px;
cursor: grab;
}
.kanban-item:last-child {
margin-bottom: 0;
}
/* Optional Tailwind CSS - Uncomment Tailwind CDN link above to use these classes instead/in addition to custom CSS */
/* .kanban-board { @apply flex gap-5 max-w-screen-lg mx-auto my-5; } */
/* .kanban-column { @apply bg-gray-200 rounded-lg p-4 w-1/4 min-h-[200px] flex flex-col; } */
/* .kanban-column-title { @apply font-bold text-xl mb-2 text-center; } */
/* .kanban-items { @apply min-h-[50px]; } */
/* .kanban-item { @apply bg-white p-3 border border-gray-300 rounded-md mb-2 cursor-grab; } */
/* .kanban-item:last-child { @apply mb-0; } */
</style>
</head>
<body>
<div class="kanban-board">
<div class="kanban-column">
<h2 class="kanban-column-title">To Do</h2>
<div class="kanban-items" id="todo-items">
<div class="kanban-item">Task 1: Plan project</div>
<div class="kanban-item">Task 2: Design mockups</div>
<div class="kanban-item">Task 3: Write documentation</div>
</div>
</div>
<div class="kanban-column">
<h2 class="kanban-column-title">Doing</h2>
<div class="kanban-items" id="doing-items">
<div class="kanban-item">Task 4: Develop feature A</div>
<div class="kanban-item">Task 5: Implement UI</div>
</div>
</div>
<div class="kanban-column">
<h2 class="kanban-column-title">Done</h2>
<div class="kanban-items" id="done-items">
<div class="kanban-item">Task 6: Test module X</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const todoItems = document.getElementById('todo-items');
const doingItems = document.getElementById('doing-items');
const doneItems = document.getElementById('done-items');
Sortable.create(todoItems, {
group: 'shared', // set both lists to same group
animation: 150,
swap: true, // Enable swap plugin
swapClass: 'highlight',
});
Sortable.create(doingItems, {
group: 'shared',
animation: 150,
swap: true,
swapClass: 'highlight',
});
Sortable.create(doneItems, {
group: 'shared',
animation: 150,
swap: true,
swapClass: 'highlight',
});
});
</script>
</body>
</html>