Compare commits

..

7 Commits

View File

@ -19,7 +19,7 @@ const tableView = true
)} )}
{tableView && ( {tableView && (
<table class={`table-auto text-left bg-[#2a2b2c] rounded-lg ${className}`}> <table class={`table-auto text-left bg-[#2a2b2c] rounded-lg ${className} w-full`}>
<thead> <thead>
<tr> <tr>
<th class="px-4 py-2">Quantity</th> <th class="px-4 py-2">Quantity</th>
@ -29,9 +29,9 @@ const tableView = true
</thead> </thead>
<tbody> <tbody>
{ {
ingredients.map((ing, index) => ( ingredients.map(ing => (
<> <>
<tr class="border-t border-white/10 cursor-pointer hover:bg-white/10 transition-opacity ingredient-row" data-index={index}> <tr class="border-t border-gray-600">
<td class="px-4 py-2">{ing.quantity}</td> <td class="px-4 py-2">{ing.quantity}</td>
<td class="px-4 py-2">{ing.unit}</td> <td class="px-4 py-2">{ing.unit}</td>
<td class="px-4 py-2">{ing.name}</td> <td class="px-4 py-2">{ing.name}</td>
@ -41,28 +41,4 @@ const tableView = true
} }
</tbody> </tbody>
</table> </table>
)} )}
<style>
.ingredient-row.completed {
/* background-color: rgba(0, 0, 0, 0.4) !important; */
opacity: 0.6;
}
.ingredient-row.completed td {
text-decoration: line-through;
color: rgba(255, 255, 255, 0.5);
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
const rows = document.querySelectorAll('.ingredient-row');
rows.forEach(row => {
row.addEventListener('click', function() {
this.classList.toggle('completed');
});
});
});
</script>