Spaces:
Running
Running
File size: 4,124 Bytes
9ca37d0 358edfe 9ca37d0 358edfe 9ca37d0 358edfe 9ca37d0 358edfe 9ca37d0 358edfe 9ca37d0 a77f23e 9ca37d0 a77f23e 358edfe 9ca37d0 1cd3159 |
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 119 120 121 122 123 124 125 126 127 128 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kanban Board</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
margin: 0;
padding: 0;
}
.kanban-board {
display: flex;
gap: 20px;
}
.column {
width: 300px;
background-color: #f4f4f4;
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
}
.column h3 {
text-align: center;
}
.card {
background-color: #fff;
border: 1px solid #ddd;
border-radius: 3px;
padding: 10px;
margin: 10px 0;
cursor: move;
}
.column.complete {
background-color: #d4edda;
border-color: #c3e6cb;
}
</style>
</head>
<body>
<div class="kanban-board" id="kanban-board"></div>
<script>
const config = [
{
title: "To Do",
cards: [
{ id: 1, title: "Identify key requirements for the healthcare product." },
{ id: 2, title: "Define initial user stories for MVP development." }
]
},
{
title: "Doing",
cards: [
{ id: 3, title: "Develop prototype features based on feedback." }
]
},
{
title: "Done",
cards: [
{ id: 4, title: "Conduct stakeholder meetings to finalize project goals." }
]
}
];
function createKanbanBoard(config) {
const board = document.getElementById('kanban-board');
config.forEach(column => {
const columnElement = document.createElement('div');
columnElement.classList.add('column');
const titleElement = document.createElement('h3');
titleElement.textContent = column.title;
columnElement.appendChild(titleElement);
const cardContainer = document.createElement('div');
cardContainer.classList.add('card-container');
cardContainer.addEventListener('dragover', (e) => e.preventDefault());
cardContainer.addEventListener('drop', (e) => {
const cardId = e.dataTransfer.getData('text');
const card = document.getElementById(cardId);
e.target.appendChild(card);
checkCompletion();
});
column.cards.forEach(card => {
const cardElement = document.createElement('div');
cardElement.classList.add('card');
cardElement.id = `card-${card.id}`;
cardElement.textContent = card.title;
cardElement.draggable = true;
cardElement.addEventListener('dragstart', (e) => {
e.dataTransfer.setData('text', cardElement.id);
});
cardContainer.appendChild(cardElement);
});
columnElement.appendChild(cardContainer);
board.appendChild(columnElement);
});
}
function checkCompletion() {
const columns = document.querySelectorAll('.column');
columns.forEach(column => {
const cards = column.querySelectorAll('.card');
const cardContainer = column.querySelector('.card-container');
if (cards.length === 0) {
cardContainer.classList.add('active');
} else {
cardContainer.classList.remove('active');
}
});
}
createKanbanBoard(config);
</script>
</body>
</html>
|