Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 36 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
<!DOCTYPE html>
<html>
<head lang="uk">
<meta charset="UTF-8">
<title>My Page</title>


<link rel="stylesheet" type="text/css" href="main.css" />
<html lang="uk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Buy List</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<span class="product-item">
Apple
<span class="amount">4</span>
</span>

<div class="badge">
<span class="badge-title">Buy List</span>
<span class="badge-author">Created by:<br><strong>Max Grygorenko</strong></span>
</div>

<div class="app">

<main class="left-col">
<div class="add-row">
<input type="text" id="item-input" placeholder="Назва товару" aria-label="Назва товару">
<button id="add-btn" data-tooltip="Додати товар">Додати</button>
</div>
<ul id="item-list"></ul>
</main>

<aside class="right-col">
<section class="summary-block">
<h2>Залишилося</h2>
<div id="remaining-list" class="tag-list"></div>
</section>
<section class="summary-block">
<h2>Куплено</h2>
<div id="bought-list" class="tag-list"></div>
</section>
</aside>

</div>

<script src="main.js"></script>
</body>
</html>
283 changes: 267 additions & 16 deletions main.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,268 @@
.product-item {
background-color: gray;
display: inline-block;
height: 25px;
padding: 5px;
border-radius: 5px;
}

.amount {
background-color: yellow;
border-radius: 10px;

display: inline-block;
height: 20px;
width: 20px;
text-align: center;
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
font-family: sans-serif;
background: #f0f0f0;
min-height: 100vh;
padding: 24px 20px 80px;
}

.app {
display: flex;
gap: 20px;
max-width: 1000px;
margin: 0 auto;
background: #e0e0e0;
border-radius: 12px;
padding: 20px;
}

@media (max-width: 650px) {
.app { flex-direction: column; }
}

.left-col {
flex: 2;
background: #fff;
border-radius: 10px;
padding: 16px;
}

.add-row {
display: flex;
gap: 10px;
margin-bottom: 16px;
}

.add-row input {
flex: 1;
padding: 10px 14px;
border: 1px solid #ccc;
border-radius: 6px;
font-size: 14px;
outline: none;
}
.add-row input:focus { border-color: #2979ff; }

button {
position: relative;
cursor: pointer;
border: none;
border-radius: 6px;
font-size: 14px;
padding: 8px 14px;
}

button::after {
content: attr(data-tooltip);
position: absolute;
bottom: calc(100% + 8px);
left: 50%;
transform: translateX(-50%) scaleY(0);
transform-origin: bottom center;
background: #6a0dad;
color: #fff;
padding: 5px 12px;
border-radius: 10px;
white-space: nowrap;
font-size: 12px;
opacity: 0;
transition: opacity 0.25s ease, transform 0.25s ease;
pointer-events: none;
z-index: 10;
}
button:hover::after {
opacity: 1;
transform: translateX(-50%) scaleY(1);
}

/* Add button */
.add-row button {
background: #2979ff;
color: #fff;
padding: 10px 20px;
font-size: 15px;
}
.add-row button:hover { background: #1565c0; }

.item-list {
list-style: none;
display: flex;
flex-direction: column;
gap: 10px;
}

.item {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 4px;
border-bottom: 1px solid #eee;
}

.item-name {
flex: 1;
font-size: 15px;
}
.item-name.bought {
text-decoration: line-through;
color: #aaa;
}

/* Qty block */
.qty-block {
display: flex;
align-items: center;
gap: 6px;
}

.qty {
min-width: 28px;
text-align: center;
font-weight: bold;
font-size: 14px;
background: #f5f5f5;
border-radius: 4px;
padding: 2px 6px;
}

.btn-circle {
width: 28px;
height: 28px;
border-radius: 50%;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
padding: 0;
}
.btn-minus { background: #e53935; }
.btn-plus { background: #43a047; }

/* Buy button */
.btn-buy {
background: #f5f5f5;
color: #333;
border: 1px solid #ccc;
}
.btn-buy.is-bought {
background: #e8f5e9;
color: #388e3c;
border-color: #a5d6a7;
}

.btn-delete {
background: #e53935;
color: #fff;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
border-radius: 4px;
padding: 0;
}

.right-col {
flex: 1;
display: flex;
flex-direction: column;
gap: 16px;
}

.summary-block {
background: #fff;
border-radius: 10px;
padding: 16px;
}
.summary-block h2 { font-size: 16px; margin-bottom: 10px; }

.tag-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
}

.tag {
background: #f0f0f0;
border-radius: 20px;
padding: 4px 10px;
font-size: 13px;
display: flex;
align-items: center;
gap: 6px;
}
.tag-count {
background: #ff6f00;
color: #fff;
border-radius: 50%;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 11px;
font-weight: bold;
}

.badge {
position: fixed;
bottom: 0;
left: 20px;
background: #4a0080;
color: #fff;
padding: 10px 20px;
border-radius: 10px 10px 0 0;
cursor: pointer;
overflow: hidden;
height: 42px;
transition: height 0.35s ease, background 0.35s ease;
z-index: 100;
}

.badge:hover {
height: 82px;
background: #7b1fa2;
}

.badge-title {
display: block;
font-weight: bold;
font-size: 15px;
}

.badge-author {
display: block;
font-size: 13px;
margin-top: 8px;
opacity: 0;
transform: translateY(8px);
transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

.badge:hover .badge-author {
opacity: 1;
transform: translateY(0);
}

@media print {
.badge {
position: static;
background: #fff !important;
color: #000 !important;
border: 2px solid #4a0080;
border-radius: 10px;
height: auto !important;
padding: 10px 20px;
margin-bottom: 16px;
}
.badge-title { display: none; }
.badge-author {
opacity: 1 !important;
transform: none !important;
}
.add-row { display: none; }
.btn-minus, .btn-plus, .btn-buy, .btn-delete { display: none; }
}
Loading