diff --git a/.changeset/plenty-maps-build.md b/.changeset/plenty-maps-build.md new file mode 100644 index 0000000000..f44969bd7d --- /dev/null +++ b/.changeset/plenty-maps-build.md @@ -0,0 +1,5 @@ +--- +'@alfalab/core-components-gallery': minor +--- + +Для мобильной версии добавлен заголовок и дата отправки + отступ между медиа diff --git a/packages/gallery/src/components/image-viewer/component.tsx b/packages/gallery/src/components/image-viewer/component.tsx index d684c66dd1..23908f9f19 100644 --- a/packages/gallery/src/components/image-viewer/component.tsx +++ b/packages/gallery/src/components/image-viewer/component.tsx @@ -66,6 +66,7 @@ export const ImageViewer: FC = () => { () => ({ slidesPerView: 1, effect: 'slide', + spaceBetween: 16, className: cn(styles.swiper, { [styles.hidden]: fullScreen && !isVideo(currentImage?.src), [styles.fullScreenVideo]: fullScreen && isVideo(currentImage?.src), diff --git a/packages/gallery/src/components/info-bar/Component.tsx b/packages/gallery/src/components/info-bar/Component.tsx index 081f2b3565..5de11797c5 100644 --- a/packages/gallery/src/components/info-bar/Component.tsx +++ b/packages/gallery/src/components/info-bar/Component.tsx @@ -7,6 +7,8 @@ import { GalleryContext } from '../../context'; import { isVideo } from '../../utils'; import * as Buttons from '../buttons'; +import { formatDate } from './utils'; + import styles from './index.module.css'; export const InfoBar = () => { @@ -14,6 +16,7 @@ export const InfoBar = () => { useContext(GalleryContext); const image = getCurrentImage(); + const createdAt = formatDate(image?.createdAt ?? ''); const handleMuteVideo = useCallback(() => { if (image) { @@ -37,14 +40,26 @@ export const InfoBar = () => { ) : ( )} - - {image?.name} - +
+ + {image?.name} + + {image?.createdAt && ( + + {createdAt} + + )} +
{mutedVideo ? ( ) : ( @@ -52,7 +67,7 @@ export const InfoBar = () => { )} ) : ( -
+
{ > {image?.name} + {image?.createdAt && ( + + {createdAt} + + )}
); }; diff --git a/packages/gallery/src/components/info-bar/index.module.css b/packages/gallery/src/components/info-bar/index.module.css index 30aa22ff56..bd392ec738 100644 --- a/packages/gallery/src/components/info-bar/index.module.css +++ b/packages/gallery/src/components/info-bar/index.module.css @@ -18,3 +18,8 @@ justify-content: space-between; } } + +.infoBlock { + display: flex; + flex-direction: column; +} diff --git a/packages/gallery/src/components/info-bar/utils/index.ts b/packages/gallery/src/components/info-bar/utils/index.ts new file mode 100644 index 0000000000..06863706df --- /dev/null +++ b/packages/gallery/src/components/info-bar/utils/index.ts @@ -0,0 +1,5 @@ +export const formatDate = (isoString: string) => { + const date = new Date(isoString); + + return date.toLocaleDateString('ru-RU'); +}; diff --git a/packages/gallery/src/docs/Component.stories.tsx b/packages/gallery/src/docs/Component.stories.tsx index de954b98f2..e37629d387 100644 --- a/packages/gallery/src/docs/Component.stories.tsx +++ b/packages/gallery/src/docs/Component.stories.tsx @@ -84,6 +84,7 @@ export const gallery: Story = { { name: 'Горизонтальное изображение.jpg', src: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwMCIgaGVpZ2h0PSI1MDAiIHZpZXdCb3g9IjAgMCAxMDAwIDUwMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjEwMDAiIGhlaWdodD0iNTAwIiBmaWxsPSIjNDU0Nzc4Ii8+Cjwvc3ZnPgo=', + createdAt: '2026-01-22T11:47:30.189083270+0000', }, { name: 'Вертикальное изображение.jpg', @@ -105,6 +106,7 @@ export const gallery: Story = { onClick: () => {}, timeout: 2, }, + createdAt: '2026-01-22T11:47:30.189083270+0000', }, { name: 'Битое изображение.jpg', diff --git a/packages/gallery/src/docs/description.mdx b/packages/gallery/src/docs/description.mdx index bc9c9de818..8da38025e8 100644 --- a/packages/gallery/src/docs/description.mdx +++ b/packages/gallery/src/docs/description.mdx @@ -5,6 +5,8 @@ const images = [ { name: 'Вертикальное изображение', src: './images/gallery_1.jpg', + createdAt: '2026-01-22T11:47:30.189083270+0000', + }, { name: 'Горизонтальное изображение', @@ -21,6 +23,7 @@ const images = [ { name: 'Alfa promo.m3u8', src: 'https://alfavideo.servicecdn.ru/videos/101064_31s0hnwZaamhbwE/master.m3u8', + createdAt: '2026-01-22T11:47:30.189083270+0000', }, { name: 'Битое изображение.jpg', diff --git a/packages/gallery/src/types.ts b/packages/gallery/src/types.ts index 6d847214be..f858bd3e65 100644 --- a/packages/gallery/src/types.ts +++ b/packages/gallery/src/types.ts @@ -16,6 +16,10 @@ export type GalleryImage = { alt?: string; canDownload?: boolean; canShare?: boolean; + /** + * дата создания + */ + createdAt?: string; /** * Нижняя кнопка, есть только у видео */