Skip to content

feat(arts-page): add arts page and fix hero frame#27

Open
oostap1985 wants to merge 3 commits into
mainfrom
feat/65099006_arts-page
Open

feat(arts-page): add arts page and fix hero frame#27
oostap1985 wants to merge 3 commits into
mainfrom
feat/65099006_arts-page

Conversation

@oostap1985

Copy link
Copy Markdown
Collaborator

Привет. Страницу артов сделал grid сеткой, при hover арты немного увеличиваются. Изменение grid позиции у арта, при наведении, сделать можно, но как-то криво смотрится. При клике по арту, модальное окно открывается. Жду комментов)

Comment thread src/_data/navLinks.json Outdated
Comment thread src/_data/arts.json
@@ -2,52 +2,61 @@
{
"artId":"ghost",
"bgColor":"Bgc-$artGhost",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Тут было бы неплохо сделать рефакторинг. Пусть название css переменной с цветом фона будет формироваться по схеме: $art${artId}. Только id надо будет перевести из cebab-case в camelCase

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Привет. Небольшой вопрос:
Если я переведу id в camelCase, то мне нужно будет переименовывать все файлы в папке arts (например: robotHare.ejs) и переименовать все переменные цвета (например: --ml-artrobotHare: #........). Делать так?

Пока не исправлял.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Существующий id не меняем. Переводим его только для получения названия CSS переменной. В шаблоне, вместо art.bgColor, будет что-то типа Bgc-$art${cebab2Camel(art.artId)}. CSS переменные с цветами тоже вроде должны быть уже с подходящими названиями. Если какие-то отдельные не будут подходить - поправь

Comment thread src/_data/arts.json Outdated
Comment thread src/arts-redesign.ejs Outdated
Comment thread src/arts-redesign.ejs Outdated

<%
const artsPageCSS = {
card:"W100p H46u Ov-h Bdrd12 Bgc-$core815 Bd3;s;$brand O0.5 O1_h sm_H50u md_H60u xxl_H-a -Ts",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Для прозрачности лучше % использовать: O50p

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

И опять же, px только в отдельных случаях: Bdrd12 -> Bdrd3u

@mr150

mr150 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

По стилю наведения карточек артов. Делаем вариант №5 из макета. При этом, backdrop-filter надо помутнее, чтобы текст кнопки хорошо читался

@oostap1985

Copy link
Copy Markdown
Collaborator Author

В последнем коммите, при xxl, арты автоматически выстраиваются в три колонки и занимают столько места по высоте, сколько передаем в "height": "....." в arts.json При добавлении нового арта, галерея сама перестроится и расположит арты так, чтобы три колонки были примерно одинаковой высоты.

Comment thread src/arts.ejs



<template id="art-card">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Зачем здесь возиться с template? Просто делаешь кастомный элемент для модалки, в модуле art-panel получаешь модалку со страницы через querySelector (до объявления класса), и добавляешь ее в поле инстанса. Там дальше с ней работаешь

@@ -0,0 +1,66 @@
export class ArtModal {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Переделываем на кастомный элемент, как писал ниже

this.sandboxLink = clone.querySelector(".art-modal-sandbox a");
this.shareBtn = clone.querySelector(".art-modal-share");

this.overlay.addEventListener("click", (e) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

закрытие должно быть и по нажатию Esc на клаве

document.body.appendChild(clone);
}

copyArtLink() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Вместо дублирования логики надо модалке передавать колбэки из art-panel

this.sandboxLink.href = `http://play.mlut.style/?art=${artId}`;
}
const artClone = artElement.querySelector(".art").cloneNode(true);
this.contentContainer.textContent = "";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Почему так очищается контент, а не через innerHTML?

if (this.sandboxLink) {
this.sandboxLink.href = `http://play.mlut.style/?art=${artId}`;
}
const artClone = artElement.querySelector(".art").cloneNode(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Модалка клонированием не занимается - туда уже готовый к отображению контент передаем

this.button.addEventListener('click', () => this.copyArtLink())
this.button.addEventListener("click", () => this.copyArtLink());
this.addEventListener("click", (e) => {
if (e.target.closest(".link-button, a")) return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

На a цепляться не стоит - лучше более специфичный селектор

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

В новой схеме вообще нет смысла в отдельном шаблоне. Это ведь не универсальная модалка, а только для артов

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

И сейчас стили модалки не упорядочены. Некоторые арты залезают под кнопки

@mr150

mr150 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

В последнем коммите, при xxl, арты автоматически выстраиваются в три колонки и занимают столько места по высоте, сколько передаем в "height": "....." в arts.json При добавлении нового арта, галерея сама перестроится и расположит арты так, чтобы три колонки были примерно одинаковой высоты.

Уже лучше, но стоит попробовать настоящий masonry сделать, если не сильно долго будет. Наверняка есть готовые vanilla js библиотеки

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants