From 337a81fc49682fc79b84403118c12b7b3684d306 Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Mon, 16 Oct 2023 10:27:55 +0300 Subject: [PATCH] fix: Update link preview border to match the new design + fix link preview highlighting --- ui/imports/shared/controls/chat/CalloutCard.qml | 12 ++++++++++++ ui/imports/shared/controls/chat/LinkPreviewCard.qml | 4 +++- ui/imports/shared/views/chat/LinksMessageView.qml | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ui/imports/shared/controls/chat/CalloutCard.qml b/ui/imports/shared/controls/chat/CalloutCard.qml index c9904483a6..c6ca809627 100644 --- a/ui/imports/shared/controls/chat/CalloutCard.qml +++ b/ui/imports/shared/controls/chat/CalloutCard.qml @@ -2,6 +2,8 @@ import QtQuick 2.13 import QtQuick.Controls 2.15 import QtQuick.Shapes 1.5 +import QtGraphicalEffects 1.15 + import utils 1.0 import shared 1.0 import shared.controls 1.0 @@ -14,6 +16,7 @@ Control { property color backgroundColor: Style.current.background property color borderColor: Style.current.border property bool dashedBorder: false + property bool dropShadow: false property real borderWidth: 1 readonly property Component clippingEffect: CalloutOpacityMask { @@ -30,5 +33,14 @@ Control { radius: Style.current.radius * 2 leftBottomRadius: root.leftTail ? Style.current.radius / 2 : Style.current.radius * 2 rightBottomRadius: root.leftTail ? Style.current.radius * 2 : Style.current.radius / 2 + layer.enabled: root.dropShadow + layer.effect: DropShadow { + verticalOffset: 3 + radius: 8 + samples: 15 + fast: true + cached: true + color: Style.current.dropShadow + } } } diff --git a/ui/imports/shared/controls/chat/LinkPreviewCard.qml b/ui/imports/shared/controls/chat/LinkPreviewCard.qml index 21755e46ec..6f6ef6722b 100644 --- a/ui/imports/shared/controls/chat/LinkPreviewCard.qml +++ b/ui/imports/shared/controls/chat/LinkPreviewCard.qml @@ -33,7 +33,8 @@ CalloutCard { implicitHeight: 290 implicitWidth: 305 hoverEnabled: true - borderColor: hovered || highlight ? Style.current.borderTertiary : Style.current.border + dropShadow: d.highlight + borderColor: d.highlight ? Style.current.background : Style.current.border Behavior on borderColor { ColorAnimation { duration: 200 } @@ -116,5 +117,6 @@ CalloutCard { QtObject { id: d property real bannerImageMargins: 1 / Screen.devicePixelRatio // image size isn't pixel perfect.. + property bool highlight: root.highlight || root.hovered } } diff --git a/ui/imports/shared/views/chat/LinksMessageView.qml b/ui/imports/shared/views/chat/LinksMessageView.qml index b3e0828b41..b87f37596a 100644 --- a/ui/imports/shared/views/chat/LinksMessageView.qml +++ b/ui/imports/shared/views/chat/LinksMessageView.qml @@ -121,6 +121,7 @@ Flow { title: standardPreview ? standardPreview.title : "" description: standardPreview ? standardPreview.description : "" footer: standardPreview ? standardPreview.hostname : "" + highlight: root.highlightLink === url onClicked: (mouse) => { switch (mouse.button) { case Qt.RightButton: