Add `shouldShowSaveAsButton` option

pull/1/head
Daniel Gasienica 7 years ago
parent 0d676a65b8
commit a7ed21a811

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

Loading…
Cancel
Save