Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OZON-68] Добавлена верстка страницы одного заказа #16

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions public/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
@import '/src/scripts/layouts/header/header.css';
@import '/src/scripts/components/auth-menu/auth-menu.css';
@import '/src/scripts/components/order-list/order-list.css';
@import '/src/scripts/components/single-order/single-order.css';

* {
margin: 0;
padding: 0;
Expand Down
8 changes: 4 additions & 4 deletions src/css/parametrs/parameters.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,20 @@
--price-font-size: 16px;
--input-font-size: 16px;
--description-font-size: 12px;
--min-font-size: 12px;
--loading-text-font-size: 16px;
--font-size-catalog-button: 35px;
--font-size_label: 14px;
--font-size-span-catalog-button: 16px;
--font-size: 18px;
--small-font-size: 12px;
--default-font-size: 18px;
--font-size20: 20px;
--big-font-size: 28px;
--big-font-size_another: 35px;
--mega-font-size: 40px;
--max-font-size: 50px;
--error-font-size: 0.875em;
--litle-font-weight: 400;
--midle-font-weight: 550;
--little-font-weight: 400;
--middle-font-weight: 550;


/* Расположение */
Expand Down
12 changes: 6 additions & 6 deletions src/scripts/components/auth-menu/auth-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ form {
}

label {
font-size: var(--font-size);
font-size: var(--default-font-size);
margin-bottom: var(--one-px-margin);
padding-bottom: var(--one-padding);
}

input {
margin-top: var(--one-px-margin);
padding: var(--mini-padding);
font-size: var(--font-size);
font-size: var(--default-font-size);
border-radius: var(--input-border-radius);
border: 1px solid #ccc;
box-shadow: 0 1px 3px var(--card-shadow-color); /* Добавляем мягкую тень для объема */
Expand All @@ -28,7 +28,7 @@ input:focus {

button[type="submit"] {
padding: var(--mini-padding);
font-size: var(--font-size);
font-size: var(--default-font-size);
font-weight: bold;
background-color: var(--base-background-color);
color: white;
Expand Down Expand Up @@ -66,14 +66,14 @@ input.invalid__input, textarea.invalid__input {

.title {
text-align: center;
font-weight: var(--midle-font-weight);
font-weight: var(--middle-font-weight);
font-size: var(--big-font-size);
margin-bottom: var(--xl-margin-bottom);
}

.auth_menu_container {
font-family: var(--mega-font-family);
font-weight: var(--litle-font-weight);
font-weight: var(--little-font-weight);
cursor: default;
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -136,7 +136,7 @@ input.invalid__input, textarea.invalid__input {
right: 12px;
top: 50%;
cursor: pointer;
font-size: var(--font-size);
font-size: var(--default-font-size);
color: var(--text-another-color);
transition: color var(--short-duration) ease, transform var(--short-duration) ease;
}
Expand Down
6 changes: 0 additions & 6 deletions src/scripts/components/card/catalog.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import "../../../css/parametrs/parameters.css";
@import "/src/css/";

body {
margin: var(--margin-zero);
Expand Down Expand Up @@ -170,11 +169,6 @@ body {
margin-top: 20%;
}

/* Оформление текста */
h1, p {
color: var(--text-another-color);
}

/* Убираем скачки, оставляем базовые стили текста */
.loading-text {
font-size: var(--loading-text-font-size);
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/components/custom-messages/error/error.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
margin-top: 20%;
}

h1, p {
.error-fade-in-text h1 p{
color: var(--text-another-color);
}

.fade-in-text {
.error-fade-in-text {
opacity: 0;
animation: fadeIn var(--one-second-duration) ease-in forwards;
}
6 changes: 3 additions & 3 deletions src/scripts/components/custom-messages/error/error.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="center-container">
<h1 class="fade-in-text">Ошибка {{name}}</h1>
<p class="fade-in-text">{{description}}</p>
<p class="fade-in-text" href="{{return}}" router="changed-active">Нажмите, сюда, чтобы вернуться на главную!</p>
<h1 class="error-fade-in-text">Ошибка {{name}}</h1>
<p class="error-fade-in-text">{{description}}</p>
<p class="error-fade-in-text" href="{{return}}" router="changed-active">Нажмите, сюда, чтобы вернуться на главную!</p>
</div>
4 changes: 2 additions & 2 deletions src/scripts/components/custom-messages/soon/soon.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
margin-top: 20%;
}

h1, p {
.soon-bounce-text h1 p {
color: var(--base-background-color);
}

.bounce-text {
.soon-bounce-text {
animation: bounce var(--two-seconds-duration) ease-in;
will-change: transform;
}
6 changes: 3 additions & 3 deletions src/scripts/components/custom-messages/soon/soon.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="center-container">
<h1 class="bounce-text">Скоро</h1>
<p class="bounce-text">Будет добавлено позже.</p>
<p class="bounce-text" href="{{return}}" router="changed-active">Нажмите, сюда, чтобы вернуться на главную!</p>
<h1 class="soon-bounce-text">Скоро</h1>
<p class="soon-bounce-text">Будет добавлено позже.</p>
<p class="soon-bounce-text" href="{{return}}" router="changed-active">Нажмите, сюда, чтобы вернуться на главную!</p>
</div>
2 changes: 1 addition & 1 deletion src/scripts/components/elements/searcher/searcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
background-color: var(--base-background-color);
border: none;
color: var(--text-buy-color);
font-size: var(--font-size);
font-size: var(--default-font-size);
border-radius: 0 5px 5px 0;
cursor: pointer;
}
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/components/order-list/order-list.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
}

.order-total {
font-size: var(--font-size);
font-weight: var(--litle-font-weight);
font-size: var(--default-font-size);
font-weight: var(--little-font-weight);
}

.review-button {
Expand Down
26 changes: 26 additions & 0 deletions src/scripts/components/single-order/single-order-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export const singleOrder = {
id: 'single-order-container',
orderNumber: '123456',
deliveryDate: '9 октября',
recipientName: 'ivan332',
recipientAddress: 'г. Москва 2-я Бауманская ул., 5',
totalItems: 2,
totalWeight: 10.3,
totalPrice: '12 345',
items: [
{
name: 'Робот пылесос',
price: '2 345',
quantity: 1,
image:
'https://sun9-27.userapi.com/impg/n4x2LZ7IpCfYgOAYedj3wkDaVS2CF1aATpCVDQ/0D8LB0AiXNs.jpg?size=1000x1000&quality=95&sign=9478ab570b9f6735a2536ec4cabf7777&type=album',
},
{
name: 'Лонгслив Cave',
price: '10 000',
quantity: 1,
image:
'https://sun9-7.userapi.com/impg/H_hFnufaf39UnwPmjsDBfVubEVr0KEVQvivSPQ/hOQU4EEcmEQ.jpg?size=750x1000&quality=95&sign=3316458ee12ef8b56ee560f7d07e2ece&type=album',
},
],
};
124 changes: 124 additions & 0 deletions src/scripts/components/single-order/single-order.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
@import "/src/css/parametrs/parameters.css";

.single-order-container {
max-width: var(--max-width-px-long);
margin: var(--big-margin) auto;
padding: var(--padding);
}

Comment on lines +3 to +8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перепиши на БЭМ

.single-order-title {
font-size: var(--big-font-size_another);
font-weight: var(--middle-font-weight);
margin-bottom: var(--big-margin-bottom);
}

.single-order-summary {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: var(--big-margin);
}

.single-order-info {
background-color: #ffffff;
border: var(--one-border) solid var(--card-border-color);
border-radius: var(--container-border-radius);
box-shadow: var(--card-box-shadow) var(--card-shadow-color);
padding: calc(var(--padding) + 2px);
width: 600px;
height: 150px;
}

.single-order-status {
display: flex;
justify-content: space-between;
align-items: center;
}

.single-order-paid-status {
font-size: var(--default-font-size);
}

.single-order-recipient {
padding-top: 48px;
}

.single-order-recipient-details {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-top: 11px;
}

.single-order-total {
display: flex;
flex-direction: column;
background-color: var(--card-background-color);
border: var(--one-border) solid var(--card-border-color);
border-radius: var(--container-border-radius);
box-shadow: var(--card-box-shadow) var(--card-shadow-color);
padding: var(--padding);
width: 500px;
height: 100px;
}

.total-header {
display: flex;
justify-content: space-between;
font-size: calc(var(--small-font-size) + 3px);
border-bottom: var(--one-border) solid var(--card-border-color);
padding-bottom: calc(var(--one-padding) + 3px);
}

.total-footer {
display: flex;
justify-content: space-between;
padding-top: 22px;
}

.total-amount {
margin-top: auto;
margin-bottom: auto;
font-weight: var(--middle-font-weight);
}

.single-order-details {
width: 600px;
background-color: var(--card-background-color);
border: var(--one-border) solid var(--card-border-color);
border-radius: var(--container-border-radius);
box-shadow: var(--card-box-shadow) var(--card-shadow-color);
padding: var(--padding);
}

.single-order-item {
display: flex;
justify-content: flex-start;
align-items: center;
padding: calc(var(--padding) + 5px);
}

.single-order-item-image {
width: 75px;
height: 75px;
border-radius: 25%;
object-fit: fill;
margin-right: var(--big-margin);
box-shadow: var(--card-box-shadow) var(--card-shadow-color);
}

.single-order-item-info {
display: flex;
flex-direction: column;
justify-content: space-evenly;
height: 75px;
}

.item-name,
.item-quantity {
font-size: calc(var(--small-font-size) + 2px);
}

.item-price {
font-weight: var(--middle-font-weight);
}
46 changes: 46 additions & 0 deletions src/scripts/components/single-order/single-order.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<div id="{{id}}" class="single-order-container">
<h2 class="single-order-title">Заказ № {{orderNumber}}</h2>

<div class="single-order-summary">
<div class="single-order-info">
<div class="single-order-status">
<p>Вы получили {{deliveryDate}}</p>
<span class="single-order-paid-status">заказ оплачен</span>
</div>
<div class="single-order-recipient">
<h4>Получатель</h4>
<div class="single-order-recipient-details">
<p>{{recipientName}}</p>
<p>{{recipientAddress}}</p>
</div>
</div>
</div>

<div class="single-order-total">
<div class="total-header">
<span>Всего: {{totalItems}} товара</span>
<span>{{totalWeight}} кг</span>
</div>
<div class="total-footer">
<h2 class="total-label">Итого</h2>
<span class="total-amount">{{totalPrice}}₽</span>
</div>
</div>
</div>

<div class="single-order-details">
<h3>Состав заказа</h3>
{{#each items as |item|}}
<div class="single-order-item">
<img src="{{item.image}}" alt="{{item.name}}" class="single-order-item-image"/>
<div class="single-order-item-info">
<span class="item-name">{{item.name}}</span>
<div class="item-price-and-quantity">
<span class="item-price">{{item.price}}₽</span>
<span class="item-quantity">{{item.quantity}} шт</span>
</div>
</div>
</div>
{{/each}}
</div>
</div>
13 changes: 13 additions & 0 deletions src/scripts/components/single-order/single-order.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { templatize } from '../../constprograms/templatizer/templatizer.js';

const singleOrderTemplateURL = 'src/scripts/components/single-order/single-order.hbs';

/**
* Функция для рендеринга страницы одного заказа.
*
* @async
* @param {Object} data - Данные для рендеринга страницы заказа.
*/
export async function buildSingleOrderPage(data) {
return templatize(document.getElementById('main'), singleOrderTemplateURL, data);
}
Loading