Files
santeh-ray/static/css/catalog.css
Azimkin 3d356c7d6a
All checks were successful
Build and Push Docker Image / build (push) Successful in 41s
feat: add price filter and dynamic slider to catalog
- Implemented JavaScript-based price slider for catalog filtering
- Updated catalog views to handle min/max price inputs and compute slider bounds
- Enhanced templates (`index.html`, `side-bar.html`) with filtering form and updated URLs
- Added CSS for price slider styling and form layout
- Introduced utility functions for URL building and price parsing
- Expanded tests for price filtering, sliders, and sidebar active states
- Updated context processor and header for dynamic navigation with price filters
2026-05-16 11:12:24 +02:00

609 lines
11 KiB
CSS

aside {
flex: 0 0 250px;
}
.catalog-container {
display: flex;
flex-direction: row;
align-items: flex-start;
gap: 28px;
margin-bottom: 80px;
}
.a-section {
margin-bottom: 24px;
}
.a-section h2 {
font-weight: 400;
font-size: 26px;
line-height: 1.2;
color: #36213e;
margin-bottom: 14px;
}
.categories {
display: flex;
flex-direction: column;
gap: 6px;
}
.category {
display: block;
padding: 6px 0;
color: #554971;
font-size: 18px;
line-height: 1.25;
transition: color 0.2s, text-decoration-color 0.2s;
}
.category:hover,
.category.active {
color: #36213e;
text-decoration: underline;
}
.categories-empty,
.item-list-empty {
color: #554971;
font-size: 18px;
line-height: 1.4;
}
.catalog-filter-form {
display: flex;
flex-direction: column;
}
.catalog-price-slider {
display: grid;
gap: 14px;
}
.catalog-price-slider__values {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
color: #554971;
font-size: 16px;
line-height: 1.2;
}
.catalog-price-slider__controls {
position: relative;
height: 32px;
}
.catalog-price-slider__track {
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 4px;
transform: translateY(-50%);
background: rgba(99, 118, 141, 0.18);
}
.catalog-price-slider__track-fill {
position: absolute;
top: 0;
bottom: 0;
background: #63768d;
}
.catalog-price-slider__range {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 32px;
margin: 0;
pointer-events: none;
appearance: none;
background: transparent;
}
.catalog-price-slider__range::-webkit-slider-thumb {
width: 18px;
height: 18px;
border: 2px solid #63768d;
border-radius: 50%;
background: #ffffff;
appearance: none;
pointer-events: auto;
cursor: pointer;
box-shadow: 0 0 0 3px rgba(99, 118, 141, 0.08);
}
.catalog-price-slider__range::-moz-range-thumb {
width: 18px;
height: 18px;
border: 2px solid #63768d;
border-radius: 50%;
background: #ffffff;
pointer-events: auto;
cursor: pointer;
box-shadow: 0 0 0 3px rgba(99, 118, 141, 0.08);
}
.catalog-price-slider__range::-webkit-slider-runnable-track {
height: 4px;
background: transparent;
}
.catalog-price-slider__range::-moz-range-track {
height: 4px;
background: transparent;
}
.catalog-price-slider__range:focus-visible {
outline: none;
}
.catalog-filter-submit {
min-height: 42px;
margin-top: 16px;
border: 1px solid #63768d;
background: #63768d;
color: #ffffff;
font-family: 'Noah', sans-serif;
font-size: 15px;
line-height: 1;
text-transform: uppercase;
cursor: pointer;
transition: background-color 0.2s, border-color 0.2s;
}
.catalog-filter-submit:hover {
background: #554971;
border-color: #554971;
}
.item-list {
flex: 1 1 auto;
min-width: 0;
}
.items-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 24px;
}
.item-card {
min-width: 0;
border: 1px solid rgba(54, 33, 62, 0.14);
background: #ffffff;
transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.item-card:hover {
border-color: rgba(54, 33, 62, 0.3);
box-shadow: 0 18px 36px rgba(54, 33, 62, 0.1);
transform: translateY(-2px);
}
.item-card-media-link {
display: block;
}
.item-card-image {
aspect-ratio: 4 / 3;
background: rgba(99, 118, 141, 0.1);
overflow: hidden;
}
.item-card-image img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.item-card-placeholder {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #63768d;
font-size: 18px;
}
.item-card-body {
padding: 18px;
}
.item-card-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 14px;
}
.item-card-category {
color: #63768d;
font-size: 15px;
line-height: 1.2;
margin-bottom: 8px;
min-width: 0;
}
.item-card-favorite-form {
flex: 0 0 auto;
}
.item-card-favorite-button {
width: 16px;
height: 16px;
border: 0;
background: transparent;
padding: 0;
color: #63768d;
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: color 0.2s, opacity 0.2s, transform 0.2s;
}
.item-card-favorite-button:hover {
color: #36213e;
opacity: 0.82;
transform: translateY(-1px);
}
.item-card-favorite-button svg {
width: 18px;
height: 18px;
}
.item-card-favorite-button.is-active {
color: #c54c5d;
}
.item-card-favorite-button--login {
text-decoration: none;
}
.item-card-title-link {
display: block;
}
.item-card-title {
color: #36213e;
font-weight: 400;
font-size: 24px;
line-height: 1.2;
display: -webkit-box;
min-height: 58px;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.item-card-description {
margin-top: 10px;
color: #554971;
font-size: 16px;
line-height: 1.35;
}
.item-card-footer {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 12px;
margin-top: 18px;
}
.item-card-price {
color: #36213e;
font-weight: 700;
font-size: 22px;
line-height: 1.2;
}
.item-card-availability {
flex: 0 0 auto;
color: #554971;
font-size: 15px;
line-height: 1.2;
}
.item-card-availability.available {
color: #4f7d4f;
}
.item-card-availability.unavailable {
color: #a14b4b;
}
.product-detail {
display: grid;
grid-template-columns: minmax(300px, 420px) minmax(320px, 1fr);
gap: 78px;
align-items: start;
margin-top: 44px;
margin-bottom: 88px;
}
.product-gallery {
min-width: 0;
}
.product-gallery__main {
width: 100%;
aspect-ratio: 1 / 0.96;
background: rgba(99, 118, 141, 0.1);
overflow: hidden;
}
.product-gallery__main a,
.product-gallery__main img {
display: block;
width: 100%;
height: 100%;
}
.product-gallery__main img {
object-fit: cover;
}
.product-gallery__placeholder {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #63768d;
font-size: 20px;
}
.product-gallery__thumbs {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 28px;
margin-top: 16px;
}
.product-gallery__thumb {
display: block;
aspect-ratio: 1.2 / 1;
background: rgba(99, 118, 141, 0.08);
border: 1px solid transparent;
overflow: hidden;
transition: border-color 0.2s, opacity 0.2s;
}
.product-gallery__thumb:hover,
.product-gallery__thumb.active {
border-color: rgba(54, 33, 62, 0.35);
}
.product-gallery__thumb img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.product-summary {
min-width: 0;
padding-top: 4px;
}
.product-summary__category {
color: #63768d;
font-size: 16px;
line-height: 1.2;
margin-bottom: 10px;
}
.product-summary__title {
max-width: 650px;
color: #36213e;
font-weight: 400;
font-size: 42px;
line-height: 1.08;
}
.product-summary__meta {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 18px;
margin-top: 16px;
}
.product-summary__price {
color: #36213e;
font-weight: 700;
font-size: 28px;
line-height: 1.2;
}
.product-summary__availability {
color: #554971;
font-size: 17px;
line-height: 1.2;
}
.product-summary__availability.available {
color: #4f7d4f;
}
.product-summary__availability.unavailable {
color: #a14b4b;
}
.product-summary__swatches {
display: flex;
align-items: center;
gap: 14px;
margin-top: 24px;
}
.product-summary__swatch {
width: 46px;
height: 46px;
border-radius: 50%;
display: block;
}
.product-summary__swatch--dark {
background: #303438;
}
.product-summary__swatch--graphite {
background: #5f6767;
}
.product-summary__swatch--taupe {
background: #927d68;
}
.product-summary__swatch--sand {
background: #cfc3ae;
}
.product-summary__description {
max-width: 560px;
margin-top: 28px;
color: #36213e;
font-size: 18px;
line-height: 1.22;
}
.product-summary__actions {
display: grid;
grid-template-columns: minmax(160px, 245px) minmax(160px, 245px);
gap: 34px;
margin-top: 88px;
}
.product-summary__cart-form {
display: contents;
}
.product-summary__button {
min-height: 38px;
border: 1px solid #63768d;
font-family: 'Noah', sans-serif;
font-size: 18px;
line-height: 1;
text-transform: uppercase;
cursor: pointer;
transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.product-summary__button--link {
display: flex;
align-items: center;
justify-content: center;
}
.product-summary__button:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.product-summary__button--primary {
background: #63768d;
color: #ffffff;
}
.product-summary__button--primary:hover {
background: #554971;
border-color: #554971;
}
.product-summary__button--secondary {
background: #ffffff;
color: #63768d;
}
.product-summary__button--secondary:hover {
border-color: #554971;
color: #36213e;
}
@media (max-width: 900px) {
.catalog-container {
flex-direction: column;
padding-left: 24px;
padding-right: 24px;
}
aside,
.item-list {
width: 100%;
flex-basis: auto;
}
.product-detail {
grid-template-columns: 1fr;
gap: 36px;
padding-left: 24px;
padding-right: 24px;
margin-top: 28px;
margin-bottom: 64px;
}
.product-summary__title {
font-size: 34px;
}
.product-summary__actions {
margin-top: 42px;
}
}
@media (max-width: 520px) {
.items-grid {
grid-template-columns: 1fr;
}
.item-card-footer {
align-items: flex-start;
flex-direction: column;
}
.item-card-header {
gap: 10px;
}
.item-card-favorite-button {
width: 38px;
height: 38px;
}
.product-gallery__thumbs {
gap: 12px;
}
.product-summary__title {
font-size: 30px;
}
.product-summary__swatch {
width: 40px;
height: 40px;
}
.product-summary__description {
font-size: 17px;
}
.product-summary__actions {
grid-template-columns: 1fr;
gap: 14px;
}
.product-summary__button {
min-height: 44px;
width: 100%;
}
}