From 4c0c55082f630e64faa3ff4411f33ca818d88334 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Thu, 26 Apr 2018 11:50:54 -0400 Subject: [PATCH] Move navigation controls to the bottom --- stylesheets/_lightbox.scss | 1 - ts/components/Lightbox.tsx | 71 +++++++++++++++++++++++++------- ts/components/LightboxGallery.md | 5 ++- 3 files changed, 60 insertions(+), 17 deletions(-) diff --git a/stylesheets/_lightbox.scss b/stylesheets/_lightbox.scss index 993897490..213e39853 100644 --- a/stylesheets/_lightbox.scss +++ b/stylesheets/_lightbox.scss @@ -19,7 +19,6 @@ background: transparent; width: 50px; height: 50px; - margin-bottom: 10px; display: inline-block; cursor: pointer; diff --git a/ts/components/Lightbox.tsx b/ts/components/Lightbox.tsx index 6dc337377..c8a1cbf38 100644 --- a/ts/components/Lightbox.tsx +++ b/ts/components/Lightbox.tsx @@ -21,14 +21,21 @@ interface Props { const styles = { container: { display: 'flex', - flexDirection: 'row', + flexDirection: 'column', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, backgroundColor: 'rgba(0, 0, 0, 0.9)', - padding: 40, + } as React.CSSProperties, + mainContainer: { + display: 'flex', + flexDirection: 'row', + paddingTop: 40, + paddingLeft: 40, + paddingRight: 40, + paddingBottom: 0, } as React.CSSProperties, objectContainer: { flexGrow: 1, @@ -48,14 +55,31 @@ const styles = { flexDirection: 'column', marginLeft: 10, } as React.CSSProperties, + navigationContainer: { + flexShrink: 0, + display: 'flex', + flexDirection: 'row', + justifyContent: 'center', + padding: 10, + } as React.CSSProperties, + saveButton: { + marginTop: 10, + }, + iconButtonPlaceholder: { + // Dimensions match `.iconButton`: + display: 'inline-block', + width: 50, + height: 50, + }, }; interface IconButtonProps { - type: 'save' | 'close' | 'previous' | 'next'; onClick?: () => void; + style?: React.CSSProperties; + type: 'save' | 'close' | 'previous' | 'next'; } -const IconButton = ({ onClick, type }: IconButtonProps) => { +const IconButton = ({ onClick, style, type }: IconButtonProps) => { const clickHandler = (event: React.MouseEvent): void => { event.preventDefault(); if (!onClick) { @@ -70,10 +94,15 @@ const IconButton = ({ onClick, type }: IconButtonProps) => { href="#" onClick={clickHandler} className={classNames('iconButton', type)} + style={style} /> ); }; +const IconButtonPlaceholder = () => ( +
+); + export class Lightbox extends React.Component { private containerRef: HTMLDivElement | null = null; @@ -95,22 +124,34 @@ export class Lightbox extends React.Component { onClick={this.onContainerClick} ref={this.setContainerRef} > -
- {!is.undefined(contentType) - ? this.renderObject({ objectURL, contentType }) - : null} +
+
+ {!is.undefined(contentType) + ? this.renderObject({ objectURL, contentType }) + : null} +
+
+ + {this.props.onSave ? ( + + ) : null} +
-
- - {this.props.onSave ? ( - - ) : null} +
{this.props.onPrevious ? ( - ) : null} + ) : ( + + )} {this.props.onNext ? ( - ) : null} + ) : ( + + )}
); diff --git a/ts/components/LightboxGallery.md b/ts/components/LightboxGallery.md index 2f2cd91c0..66f90e0dc 100644 --- a/ts/components/LightboxGallery.md +++ b/ts/components/LightboxGallery.md @@ -4,7 +4,10 @@ const noop = () => {}; const items = [ { objectURL: 'https://placekitten.com/800/600', contentType: 'image/jpeg' }, { objectURL: 'https://placekitten.com/900/600', contentType: 'image/jpeg' }, - { objectURL: 'https://placekitten.com/1000/800', contentType: 'image/jpeg' }, + { objectURL: 'https://placekitten.com/980/800', contentType: 'image/jpeg' }, + { objectURL: 'https://placekitten.com/656/540', contentType: 'image/jpeg' }, + { objectURL: 'https://placekitten.com/762/400', contentType: 'image/jpeg' }, + { objectURL: 'https://placekitten.com/920/620', contentType: 'image/jpeg' }, ];