diff --git a/ts/components/Lightbox.md b/ts/components/Lightbox.md index 079dc642c..0840244f1 100644 --- a/ts/components/Lightbox.md +++ b/ts/components/Lightbox.md @@ -1,3 +1,5 @@ +## Image (supported format) + ```js const noop = () => {}; @@ -9,3 +11,51 @@ const noop = () => {}; /> ; ``` + +## Image (unsupported format) + +```js +const noop = () => {}; + +
+ +
; +``` + +## Video (supported format) + +```js +const noop = () => {}; + +
+ +
; +``` + +## Video (unsupported format) + +```js +const noop = () => {}; + +
+ +
; +``` + +## Unsupported file format + +```js +const noop = () => {}; + +
+ +
; +``` diff --git a/ts/components/Lightbox.tsx b/ts/components/Lightbox.tsx index af9191488..23ca8a6b8 100644 --- a/ts/components/Lightbox.tsx +++ b/ts/components/Lightbox.tsx @@ -3,8 +3,10 @@ import React from 'react'; import classNames from 'classnames'; import is from '@sindresorhus/is'; +import * as Colors from './styles/Colors'; import * as GoogleChrome from '../util/GoogleChrome'; import * as MIME from '../types/MIME'; +import { colorSVG } from '../styles/colorSVG'; interface Props { close: () => void; @@ -50,6 +52,13 @@ const styles = { maxHeight: '100%', objectFit: 'contain', } as React.CSSProperties, + video: { + flexGrow: 1, + flexShrink: 0, + maxWidth: '100%', + maxHeight: '100%', + objectFit: 'contain', + } as React.CSSProperties, controlsOffsetPlaceholder: { width: CONTROLS_WIDTH, marginRight: CONTROLS_SPACING, @@ -110,6 +119,25 @@ const IconButtonPlaceholder = () => (
); +const Icon = ({ + onClick, + url, +}: { + onClick?: ( + event: React.MouseEvent + ) => void; + url: string; +}) => ( +
+); + export class Lightbox extends React.Component { private containerRef: HTMLDivElement | null = null; @@ -172,8 +200,8 @@ export class Lightbox extends React.Component { objectURL: string; contentType: MIME.MIMEType; }) => { - const isImage = GoogleChrome.isImageTypeSupported(contentType); - if (isImage) { + const isImageTypeSupported = GoogleChrome.isImageTypeSupported(contentType); + if (isImageTypeSupported) { return ( { ); } - const isVideo = GoogleChrome.isVideoTypeSupported(contentType); - if (isVideo) { + const isVideoTypeSupported = GoogleChrome.isVideoTypeSupported(contentType); + if (isVideoTypeSupported) { return ( -