Co-authored-by: scott@signal.org
Co-authored-by: ken@signal.org
This commit is contained in:
Ken Powers 2019-05-16 15:32:11 -07:00 committed by Scott Nonnenberg
parent 8c8856785b
commit 29de50c12a
100 changed files with 7572 additions and 693 deletions

View file

@ -20,6 +20,8 @@ interface Props {
withContentAbove?: boolean;
withContentBelow?: boolean;
bottomOverlay?: boolean;
isSticker?: boolean;
stickerSize?: number;
i18n: LocalizerType;
@ -34,6 +36,8 @@ export class ImageGrid extends React.Component<Props> {
attachments,
bottomOverlay,
i18n,
isSticker,
stickerSize,
onError,
onClick,
withContentAbove,
@ -56,25 +60,31 @@ export class ImageGrid extends React.Component<Props> {
if (attachments.length === 1 || !areAllAttachmentsVisual(attachments)) {
const { height, width } = getImageDimensions(attachments[0]);
const finalHeight = isSticker ? stickerSize : height;
const finalWidth = isSticker ? stickerSize : width;
return (
<div
className={classNames(
'module-image-grid',
'module-image-grid--one-image'
'module-image-grid--one-image',
isSticker ? 'module-image-grid--with-sticker' : null
)}
>
<Image
alt={getAlt(attachments[0], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
noBackground={isSticker}
curveTopLeft={curveTopLeft}
curveTopRight={curveTopRight}
curveBottomLeft={curveBottomLeft}
curveBottomRight={curveBottomRight}
attachment={attachments[0]}
playIconOverlay={isVideoAttachment(attachments[0])}
height={height}
width={width}
height={finalHeight}
width={finalWidth}
url={getUrl(attachments[0])}
onClick={onClick}
onError={onError}
@ -91,6 +101,7 @@ export class ImageGrid extends React.Component<Props> {
i18n={i18n}
attachment={attachments[0]}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
curveTopLeft={curveTopLeft}
curveBottomLeft={curveBottomLeft}
playIconOverlay={isVideoAttachment(attachments[0])}
@ -104,6 +115,7 @@ export class ImageGrid extends React.Component<Props> {
alt={getAlt(attachments[1], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
curveTopRight={curveTopRight}
curveBottomRight={curveBottomRight}
playIconOverlay={isVideoAttachment(attachments[1])}
@ -125,6 +137,7 @@ export class ImageGrid extends React.Component<Props> {
alt={getAlt(attachments[0], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
curveTopLeft={curveTopLeft}
curveBottomLeft={curveBottomLeft}
attachment={attachments[0]}
@ -152,6 +165,7 @@ export class ImageGrid extends React.Component<Props> {
alt={getAlt(attachments[2], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
curveBottomRight={curveBottomRight}
height={99}
width={99}
@ -201,6 +215,7 @@ export class ImageGrid extends React.Component<Props> {
alt={getAlt(attachments[2], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
curveBottomLeft={curveBottomLeft}
playIconOverlay={isVideoAttachment(attachments[2])}
height={149}
@ -214,6 +229,7 @@ export class ImageGrid extends React.Component<Props> {
alt={getAlt(attachments[3], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
curveBottomRight={curveBottomRight}
playIconOverlay={isVideoAttachment(attachments[3])}
height={149}
@ -268,6 +284,7 @@ export class ImageGrid extends React.Component<Props> {
alt={getAlt(attachments[2], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
curveBottomLeft={curveBottomLeft}
playIconOverlay={isVideoAttachment(attachments[2])}
height={99}
@ -281,6 +298,7 @@ export class ImageGrid extends React.Component<Props> {
alt={getAlt(attachments[3], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
playIconOverlay={isVideoAttachment(attachments[3])}
height={99}
width={98}
@ -293,6 +311,7 @@ export class ImageGrid extends React.Component<Props> {
alt={getAlt(attachments[4], i18n)}
i18n={i18n}
bottomOverlay={withBottomOverlay}
noBorder={isSticker}
curveBottomRight={curveBottomRight}
playIconOverlay={isVideoAttachment(attachments[4])}
height={99}