Skip to content

Commit

Permalink
feat: image preview title
Browse files Browse the repository at this point in the history
  • Loading branch information
edison-hm committed Feb 17, 2025
1 parent e327663 commit 738d5a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/zarm/src/image-preview/ImagePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const ImagePreview = React.forwardRef<HTMLDivElement, ImagePreviewProps>((props,
className,
style,
mountContainer,
title,
} = props;

const [images, setImages] = useState<Images>(formatImages(props.images));
Expand Down Expand Up @@ -171,6 +172,7 @@ const ImagePreview = React.forwardRef<HTMLDivElement, ImagePreviewProps>((props,
maskOpacity={1}
>
<>
<div className={bem('title')}>{title}</div>
<div ref={ref} className={bem('content')} {...bindEvent()}>
{visible &&
(images?.length ? (
Expand Down
2 changes: 2 additions & 0 deletions packages/zarm/src/image-preview/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ const Demo = () => {
</List.Item>
</List>
<ImagePreview
title="缩略图预览"
visible={visibleState.common}
images={commonImages}
onClose={() => hide('common')}
maxScale={10}
orientation={orientation}
/>
<ImagePreview
title="原始图预览"
visible={visibleState.origin}
images={originImages}
onClose={() => hide('origin')}
Expand Down
13 changes: 13 additions & 0 deletions packages/zarm/src/image-preview/style/component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@

padding: 0;

@include e(title) {
text-align: center;
position: absolute;
top: 0;
left: 50%;
transform: translate(-50%, 0);
height: 60px;
line-height: 60px;
font-size: var(--pagination-font-size);
font-weight: var(--title-font-weight);
color: var(--za-color-text-inverse);
}

@include e(content) {
display: flex;
align-items: center;
Expand Down

0 comments on commit 738d5a6

Please sign in to comment.