Corp/backend/static/css/components/chat-date-groups.css
Игорь Надеин 0e2a08fb38 chore: Add remaining test files and utilities
Added:
- Test chat API script
- Date group CSS and JS utilities
- IntersectionObserver modules
- Bidirectional loading test files
- Autoscroll testing checklist
2026-01-13 15:02:29 +03:00

241 lines
5.6 KiB
CSS
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.

/**
* Chat Date Groups - Стили для группировки сообщений по датам
*
* Основано на Telegram Web архитектуре:
* - Sticky positioning для дат
* - Плавные transitions
* - Адаптивная типографика
*/
/* ==================== Message Date Group ==================== */
/**
* Контейнер группы сообщений одной даты
*/
.message-date-group {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
}
/* ==================== Sticky Date Header ==================== */
/**
* Sticky date header (прилипает к верху при скролле)
*/
.sticky-date {
position: sticky;
top: 56px; /* Высота chat-header */
z-index: 2;
/* Layout */
display: flex;
align-items: center;
justify-content: center;
padding: 12px 16px;
margin: 0;
/* Typography */
font-size: 0.875rem;
font-weight: 500;
color: var(--bs-secondary);
text-align: center;
/* Визуальные эффекты */
background-color: transparent;
pointer-events: none; /* Не блокирует клики по умолчанию */
/* Transitions */
transition: opacity 0.15s ease, background-color 0.2s ease;
}
/**
* Внутренний span с текстом даты
*/
.sticky-date span {
display: inline-block;
padding: 6px 12px;
border-radius: 12px;
background-color: var(--bs-light);
pointer-events: all; /* Только текст кликабельный */
/* Shadow для лучшей читаемости */
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
/* Transitions */
transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
/**
* Интерактивный режим (кликабельная дата)
*/
.sticky-date.interactive span {
cursor: pointer;
user-select: none;
}
.sticky-date.interactive span:hover {
background-color: var(--bs-primary);
color: white;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
transform: translateY(-1px);
}
.sticky-date.interactive span:active {
transform: translateY(0);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
/**
* Состояние sticky (когда дата "прилипла" к верху)
* Добавляется через IntersectionObserver
*/
.sticky-date.is-sticky {
/* Можно добавить визуальный эффект для sticky состояния */
/* Например, изменить фон или тень */
}
.sticky-date.is-sticky span {
background-color: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
/* ==================== Messages Container ==================== */
/**
* Контейнер для сообщений внутри date group
*/
.messages-container {
display: flex;
flex-direction: column;
width: 100%;
gap: 0; /* Сообщения сами управляют своими отступами */
}
/* ==================== Dark Mode Support ==================== */
@media (prefers-color-scheme: dark) {
.sticky-date {
color: var(--bs-light);
}
.sticky-date span {
background-color: rgba(52, 58, 64, 0.95);
color: var(--bs-light);
}
.sticky-date.interactive span:hover {
background-color: var(--bs-primary);
color: white;
}
.sticky-date.is-sticky span {
background-color: rgba(52, 58, 64, 0.98);
backdrop-filter: blur(10px);
}
}
/* ==================== Responsive Design ==================== */
/**
* Mobile adjustments
*/
@media (max-width: 576px) {
.sticky-date {
top: 48px; /* Меньшая высота header на мобильных */
padding: 10px 12px;
font-size: 0.8125rem;
}
.sticky-date span {
padding: 5px 10px;
border-radius: 10px;
}
}
/**
* Tablet adjustments
*/
@media (min-width: 577px) and (max-width: 992px) {
.sticky-date {
top: 52px;
}
}
/* ==================== Print Styles ==================== */
@media print {
.sticky-date {
position: static;
page-break-inside: avoid;
}
.sticky-date.interactive span {
cursor: default;
}
}
/* ==================== Accessibility ==================== */
/**
* High contrast mode support
*/
@media (prefers-contrast: high) {
.sticky-date span {
border: 1px solid currentColor;
}
}
/**
* Reduced motion support
*/
@media (prefers-reduced-motion: reduce) {
.sticky-date,
.sticky-date span {
transition: none;
}
}
/* ==================== Loading State ==================== */
/**
* Skeleton loader для date groups (опционально)
*/
.message-date-group.loading .sticky-date span {
animation: pulse 1.5s ease-in-out infinite;
background: linear-gradient(
90deg,
var(--bs-light) 25%,
rgba(0, 0, 0, 0.05) 50%,
var(--bs-light) 75%
);
background-size: 200% 100%;
}
@keyframes pulse {
0%, 100% {
background-position: 200% 0;
}
50% {
background-position: 0 0;
}
}
/* ==================== RTL Support ==================== */
[dir="rtl"] .sticky-date span {
/* RTL adjustments если потребуется */
}
/* ==================== Focus Styles ==================== */
/**
* Keyboard navigation support
*/
.sticky-date.interactive span:focus-visible {
outline: 2px solid var(--bs-primary);
outline-offset: 2px;
}