From 96be0df8c72b5e43aa36f6cbcdfaeea3f1b07d46 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Tue, 24 Apr 2018 16:12:07 -0400 Subject: [PATCH] Show lightbox controls based on presence of handlers --- js/views/conversation_view.js | 1 - ts/components/Lightbox.md | 8 +++++--- ts/components/Lightbox.tsx | 18 +++--------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index cdc7e418876..adde9b4580f 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -589,7 +589,6 @@ documents: [], onItemClick: ({message}) => { const lightboxProps = { - shouldShowSaveAsButton: false, imageURL: message.objectURL, }; this.lightboxView = new Whisper.ReactWrapperView({ diff --git a/ts/components/Lightbox.md b/ts/components/Lightbox.md index e6aa1395bfc..a5fbd148e62 100644 --- a/ts/components/Lightbox.md +++ b/ts/components/Lightbox.md @@ -1,10 +1,12 @@ ```js +const noop = () => {}; +
``` diff --git a/ts/components/Lightbox.tsx b/ts/components/Lightbox.tsx index f1e111f2697..7f119d79079 100644 --- a/ts/components/Lightbox.tsx +++ b/ts/components/Lightbox.tsx @@ -11,9 +11,6 @@ interface Props { onNext?: () => void; onPrevious?: () => void; onSave: () => void; - shouldShowNextButton: boolean; - shouldShowPreviousButton: boolean; - shouldShowSaveAsButton: boolean; } const styles = { @@ -57,12 +54,6 @@ const IconButton = ({ onClick, type }: IconButtonProps) => ( ); export class Lightbox extends React.Component { - public static defaultProps: Partial = { - shouldShowNextButton: false, - shouldShowPreviousButton: false, - shouldShowSaveAsButton: false, - }; - private containerRef: HTMLDivElement | null = null; public componentDidMount() { @@ -78,9 +69,6 @@ export class Lightbox extends React.Component { public render() { const { imageURL, - shouldShowNextButton, - shouldShowPreviousButton, - shouldShowSaveAsButton, } = this.props; return (
{
- {shouldShowSaveAsButton ? ( + {this.props.onSave ? ( ) : null} - {shouldShowPreviousButton ? ( + {this.props.onPrevious ? ( ) : null} - {shouldShowNextButton ? ( + {this.props.onNext ? ( ) : null}