Corp/backend/static/scss/components/_comments.scss
Игорь Надеин f955185b91 fix(post-modal): исправлена отрисовка комментариев в модале
- Комментарии автора поста отображаются справа без бейджа
- Форма ввода комментариев теперь не накладывается на список (position: relative вместо sticky)
- Исправлена автоматическая прокрутка к низу комментариев при открытии модала (requestAnimationFrame)
- Блок комментариев использует flex-layout для правильного размещения
- Секция комментариев имеет min-height: 300px и max-height: 65vh
- Добавлена граница сверху формы ввода для визуального разделения
2025-11-29 15:57:26 +03:00

159 lines
3.7 KiB
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// =============================================================================
// Comments Component
// =============================================================================
// Единый стиль для комментариев во всех местах приложения:
// - В карточках постов (_feed_cards.html)
// - На странице деталей поста (post_detail.html)
// - В модальном окне (postDetailModal.js)
.comment-item {
padding: 0.5rem 0; // py-2
display: flex;
flex-direction: column;
align-items: flex-start;
.comment-header {
font-size: 0.875rem; // small
margin-bottom: 0.25rem;
display: flex;
align-items: center;
flex-wrap: wrap;
.comment-author {
font-weight: 600; // fw-semibold
text-decoration: none;
color: inherit;
&:hover {
text-decoration: underline;
}
}
.comment-separator {
color: var(--bs-secondary);
margin: 0 0.25rem;
}
.comment-date {
color: var(--bs-secondary);
}
.badge {
font-size: 0.7rem;
padding: 0.15rem 0.4rem;
}
}
.comment-body {
font-size: 0.875rem; // small
line-height: 1.5;
white-space: pre-wrap;
word-wrap: break-word;
background: var(--bs-tertiary-bg);
padding: 0.5rem 0.75rem;
border-radius: 12px;
max-width: 80%;
}
// Комментарии автора поста справа
&.comment-item--author {
align-items: flex-end;
.comment-header {
flex-direction: row-reverse;
.comment-separator {
order: 0;
}
.comment-date {
order: -1;
}
}
.comment-body {
background: var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.1));
border: 1px solid var(--bs-primary-border-subtle, rgba(13, 110, 253, 0.2));
}
}
}
// Контейнер для списка комментариев
.comments-list {
margin-bottom: 1rem;
}
// Заголовок секции комментариев
.comments-section-header {
display: flex;
align-items: center;
margin-bottom: 0.5rem;
.comments-icon {
font-size: 1.5rem;
color: var(--bs-primary);
margin-right: 0.5rem;
}
.comments-title {
margin-bottom: 0;
}
.comments-count {
font-size: 0.875rem;
color: var(--bs-secondary);
margin-left: 0.5rem;
}
}
// Обёртка для комментариев с sticky формой
.comments-section-wrapper {
position: relative;
display: flex;
flex-direction: column;
min-height: 300px;
max-height: 65vh; // Максимальная высота всей секции
}
// Скроллируемая область с комментариями
.comments-scrollable {
flex: 1 1 auto;
overflow-y: auto;
overflow-x: hidden;
min-height: 0; // Важно для правильной работы flex
display: flex;
flex-direction: column;
// Firefox скроллбар
scrollbar-width: thin;
scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
// Стилизация скроллбара (Chrome, Safari, Edge)
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.15);
border-radius: 4px;
&:hover {
background: rgba(0, 0, 0, 0.25);
}
}
}
// Sticky форма для комментариев
.comment-form-sticky {
flex: 0 0 auto;
position: relative; // Изменено с sticky на relative
z-index: 10;
background: var(--bs-body-bg);
border-top: 1px solid var(--bs-border-color);
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}