Replace Backbone with React lightbox
parent
cb94d09ef9
commit
4a5a2cb5c1
@ -1,59 +1,9 @@
|
||||
.lightbox {
|
||||
&.modal {
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
background-color: rgba(0,0,0,0.8);
|
||||
|
||||
.content {
|
||||
margin: 0;
|
||||
padding: 0 60px;
|
||||
max-width: 100%;
|
||||
height: 100%;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
margin: auto;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.controls {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
a {
|
||||
background: transparent;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
padding: 3px;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: $grey;
|
||||
}
|
||||
}
|
||||
|
||||
.save {
|
||||
&:before {
|
||||
@include color-svg('../images/save.svg', white);
|
||||
}
|
||||
}
|
||||
}
|
||||
.lightboxContainer {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: $z-index-modal;
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import React from 'react';
|
||||
|
||||
|
||||
interface Props {
|
||||
imageURL?: string;
|
||||
onClose: () => void;
|
||||
close: () => void;
|
||||
}
|
||||
|
||||
const styles = {
|
||||
container: {
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
||||
padding: 20,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
image: {
|
||||
maxWidth: '100%',
|
||||
maxHeight: '100%',
|
||||
objectFit: 'cover',
|
||||
}
|
||||
};
|
||||
|
||||
export class Lightbox extends React.Component<Props, {}> {
|
||||
public render() {
|
||||
const { imageURL } = this.props;
|
||||
return (
|
||||
<div style={styles.container}>
|
||||
<img
|
||||
style={styles.image}
|
||||
src={imageURL}
|
||||
/>
|
||||
<button onClick={this.props.close}>Close</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue