fix: Update link preview border to match the new design

+ fix link preview highlighting
This commit is contained in:
Alex Jbanca 2023-10-16 10:27:55 +03:00 committed by Alex Jbanca
parent 0ba9ce9c8e
commit 337a81fc49
3 changed files with 16 additions and 1 deletions

View File

@ -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
}
}
}

View File

@ -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
}
}

View File

@ -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: