mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-22 17:38:10 +01:00
Update styles for MediaGallery
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import React, { useRef, useState } from 'react';
|
||||
import React, { useRef, useState, type ReactNode } from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { SpinnerV2 } from '../SpinnerV2';
|
||||
@@ -13,9 +13,9 @@ const TRANSITION_DELAY = 200;
|
||||
|
||||
export type PropsType = {
|
||||
attachment: AttachmentForUIType | undefined;
|
||||
isAttachmentNotAvailable: boolean;
|
||||
isExpired?: boolean;
|
||||
isIncoming: boolean;
|
||||
renderAttachmentDownloaded: () => JSX.Element;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
enum IconState {
|
||||
@@ -26,12 +26,18 @@ enum IconState {
|
||||
|
||||
export function AttachmentStatusIcon({
|
||||
attachment,
|
||||
isAttachmentNotAvailable,
|
||||
isExpired,
|
||||
isIncoming,
|
||||
renderAttachmentDownloaded,
|
||||
children,
|
||||
}: PropsType): JSX.Element | null {
|
||||
const [isWaiting, setIsWaiting] = useState<boolean>(false);
|
||||
|
||||
const isAttachmentNotAvailable =
|
||||
isExpired ||
|
||||
(attachment != null &&
|
||||
attachment.isPermanentlyUndownloadable &&
|
||||
!attachment.wasTooBig);
|
||||
|
||||
let state: IconState = IconState.Downloaded;
|
||||
if (attachment && isAttachmentNotAvailable) {
|
||||
state = IconState.Downloaded;
|
||||
@@ -159,9 +165,5 @@ export function AttachmentStatusIcon({
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="AttachmentStatusIcon__container">
|
||||
{renderAttachmentDownloaded()}
|
||||
</div>
|
||||
);
|
||||
return <div className="AttachmentStatusIcon__container">{children}</div>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user