-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathlightbox-dialog.tsx
58 lines (54 loc) · 1.61 KB
/
lightbox-dialog.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React, { CSSProperties, FC } from 'react'
import classNames from 'classnames'
import { DialogBaseProps, DialogBaseWithState } from '../ebay-dialog-base'
type Mode = 'default' | 'mini'
type Size = 'wide' | 'narrow' | 'fullscreen' | 'large'
export type Props<T = any> = Omit<DialogBaseProps<T>, 'size'> & {
open?: boolean;
mode?: Mode;
size?: Size;
bannerImgSrc?: string;
bannerImgPosition?: CSSProperties['backgroundPosition'];
onClose?: () => void;
}
const EbayLightboxDialog: FC<Props> = ({
open,
mode,
size,
bannerImgSrc,
bannerImgPosition,
onClose = () => {},
...rest
}) => {
const top = bannerImgSrc ? (
<div
className="lightbox-dialog__image"
style={{
backgroundImage: `url(${bannerImgSrc})`,
backgroundPosition: bannerImgPosition
}} />
) : rest.top
return (
<DialogBaseWithState
buttonPosition="right"
{...rest}
classPrefix="lightbox-dialog"
onCloseBtnClick={onClose}
onBackgroundClick={onClose}
className={classNames(
rest.className,
'lightbox-dialog--mask-fade',
{
[`lightbox-dialog--${size}`]: size,
'lightbox-dialog--expressive': bannerImgSrc
}
)}
windowClass={classNames('lightbox-dialog__window--fade', {
'lightbox-dialog__window--mini': mode === 'mini'
})}
top={top}
open={open}
/>
)
}
export default EbayLightboxDialog