Add shouldShowSaveAsButton option

This commit is contained in:
Daniel Gasienica 2018-04-15 02:27:34 -04:00
parent 0d676a65b8
commit a7ed21a811

View file

@ -13,6 +13,7 @@ interface Props {
onSave: () => void;
shouldShowNextButton: boolean;
shouldShowPreviousButton: boolean;
shouldShowSaveAsButton: boolean;
}
const styles = {
@ -61,6 +62,7 @@ export class Lightbox extends React.Component<Props, {}> {
public static defaultProps: Partial<Props> = {
shouldShowNextButton: false,
shouldShowPreviousButton: false,
shouldShowSaveAsButton: false,
};
public componentDidMount() {
@ -78,6 +80,7 @@ export class Lightbox extends React.Component<Props, {}> {
imageURL,
shouldShowNextButton,
shouldShowPreviousButton,
shouldShowSaveAsButton,
} = this.props;
return (
<div
@ -94,7 +97,9 @@ export class Lightbox extends React.Component<Props, {}> {
</div>
<div style={styles.controls}>
<IconButton type="close" onClick={this.onClose} />
<IconButton type="save" onClick={this.props.onSave} />
{shouldShowSaveAsButton ? (
<IconButton type="save" onClick={this.props.onSave} />
) : null}
{shouldShowPreviousButton ? (
<IconButton type="previous" onClick={this.props.onPrevious} />
) : null}