/**
* @prettier
*/
import React from 'react';
import classNames from 'classnames';
interface Props {
close: () => void;
imageURL?: string;
onSave: () => void;
}
const styles = {
container: {
display: 'flex',
flexDirection: 'row',
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
backgroundColor: 'rgba(0, 0, 0, 0.9)',
padding: 40,
} as React.CSSProperties,
objectContainer: {
flexGrow: 1,
display: 'inline-flex',
justifyContent: 'center',
} as React.CSSProperties,
image: {
flexGrow: 1,
flexShrink: 0,
maxWidth: '100%',
maxHeight: '100%',
objectFit: 'contain',
} as React.CSSProperties,
controls: {
flexShrink: 0,
display: 'flex',
flexDirection: 'column',
marginLeft: 10,
} as React.CSSProperties,
};
interface IconButtonProps {
type: 'save' | 'close' | 'previous' | 'next';
onClick?: () => void;
}
const IconButton = ({ onClick, type }: IconButtonProps) => (
);
export class Lightbox extends React.Component {
public componentDidMount() {
const useCapture = true;
document.addEventListener('keyup', this.onKeyUp, useCapture);
}
public componentWillMount() {
const useCapture = true;
document.removeEventListener('keyup', this.onKeyUp, useCapture);
}
public render() {
const { imageURL } = this.props;
return (
);
}
private onKeyUp = (event: KeyboardEvent) => {
if (event.key !== 'Escape') {
return;
}
this.props.close();
};
}