From ba959f33791fd4cc1a5c8aebe004dc37f39a4cc8 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 28 Oct 2020 13:29:45 +1100 Subject: [PATCH] link preview state moved to SessionCompositionBox --- stylesheets/_modules.scss | 8 +- .../conversation/StagedLinkPreview.tsx | 9 +- .../conversation/SessionCompositionBox.tsx | 167 ++++++++++++++---- .../conversation/SessionStagedLinkPreview.tsx | 82 ++------- 4 files changed, 164 insertions(+), 102 deletions(-) diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 3cf2336df..769622bd3 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -2323,11 +2323,11 @@ .module-staged-link-preview__icon-container { margin-inline-end: 8px; + padding: $session-margin-sm; } .module-staged-link-preview__content { margin-inline-end: 20px; - padding-inline-start: $session-margin-sm; - padding-inline-end: $session-margin-sm; + padding: $session-margin-sm; } .module-staged-link-preview__title { color: $color-gray-90; @@ -2351,8 +2351,8 @@ .module-staged-link-preview__close-button { cursor: pointer; position: absolute; - top: 0px; - right: 0px; + top: 5px; + right: 5px; height: 16px; width: 16px; diff --git a/ts/components/conversation/StagedLinkPreview.tsx b/ts/components/conversation/StagedLinkPreview.tsx index 06c0fe225..56a8a6194 100644 --- a/ts/components/conversation/StagedLinkPreview.tsx +++ b/ts/components/conversation/StagedLinkPreview.tsx @@ -8,15 +8,16 @@ import { AttachmentType, isImageAttachment } from '../../types/Attachment'; type Props = { isLoaded: boolean; title: null | string; + url: null | string; description: null | string; domain: null | string; image?: AttachmentType; - onClose: () => void; + onClose: (url: string) => void; }; export const StagedLinkPreview = (props: Props) => { - const { isLoaded, onClose, title, image, domain, description } = props; + const { isLoaded, onClose, title, image, domain, description, url } = props; const isImage = image && isImageAttachment(image); const i18n = window.i18n; @@ -65,7 +66,9 @@ export const StagedLinkPreview = (props: Props) => {