mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-22 19:48:52 +00:00
chore(wallet): moving animated text from inline to stand alone component
This commit is contained in:
parent
20bc37559f
commit
babc3f7ddd
51
ui/StatusQ/src/StatusQ/Controls/StatusAnimatedText.qml
Normal file
51
ui/StatusQ/src/StatusQ/Controls/StatusAnimatedText.qml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
import StatusQ.Core 0.1
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\qmltype StatusAnimatedText
|
||||||
|
\inherits StatusBaseText
|
||||||
|
\inqmlmodule StatusQ.Controls
|
||||||
|
\since StatusQ.Controls 0.1
|
||||||
|
\brief Displays a status base text with color animation on text change
|
||||||
|
|
||||||
|
A property animation is exposed in case any further change is needed, like setting different
|
||||||
|
than the default color for animation. For more context on that refer to `StatusColorAnimation`
|
||||||
|
component.
|
||||||
|
|
||||||
|
Example of how to use it:
|
||||||
|
|
||||||
|
\qml
|
||||||
|
StatusAnimatedText {
|
||||||
|
id: animatedText
|
||||||
|
|
||||||
|
text: "anything"
|
||||||
|
color: "red"
|
||||||
|
animation.toColor: "blue"
|
||||||
|
}
|
||||||
|
\endqml
|
||||||
|
|
||||||
|
For a list of components available see StatusQ.
|
||||||
|
*/
|
||||||
|
|
||||||
|
StatusBaseText {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property alias animation: animate // Expose animation for customization
|
||||||
|
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
elide: Text.ElideRight
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
if (text === "") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
animate.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusColorAnimation {
|
||||||
|
id: animate
|
||||||
|
target: root
|
||||||
|
fromColor: root.color
|
||||||
|
}
|
||||||
|
}
|
@ -95,34 +95,16 @@ Control {
|
|||||||
horizontalPadding: 8
|
horizontalPadding: 8
|
||||||
verticalPadding: 8
|
verticalPadding: 8
|
||||||
|
|
||||||
component AnimatedText: StatusBaseText {
|
property Component subTextComponent: StatusAnimatedText {
|
||||||
id: animatedText
|
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
font: root.font
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
elide: Text.ElideRight
|
|
||||||
|
|
||||||
onTextChanged: {
|
|
||||||
if (text === "") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
animate.restart()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
StatusColorAnimation {
|
|
||||||
id: animate
|
|
||||||
target: animatedText
|
|
||||||
fromColor: animatedText.color
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
property Component subTextComponent: AnimatedText {
|
|
||||||
text: root.subText
|
text: root.subText
|
||||||
|
font: root.font
|
||||||
}
|
}
|
||||||
|
|
||||||
property Component additionalTextComponent: AnimatedText {
|
property Component additionalTextComponent: StatusAnimatedText {
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
text: root.additionalText
|
text: root.additionalText
|
||||||
|
font: root.font
|
||||||
color: Theme.palette.baseColor1
|
color: Theme.palette.baseColor1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ module StatusQ.Controls
|
|||||||
|
|
||||||
StatusActivityCenterButton 0.1 StatusActivityCenterButton.qml
|
StatusActivityCenterButton 0.1 StatusActivityCenterButton.qml
|
||||||
StatusAmountInput 0.1 StatusAmountInput.qml
|
StatusAmountInput 0.1 StatusAmountInput.qml
|
||||||
|
StatusAnimatedText 0.1 StatusAnimatedText.qml
|
||||||
StatusBackButton 0.1 StatusBackButton.qml
|
StatusBackButton 0.1 StatusBackButton.qml
|
||||||
StatusBanner 0.1 StatusBanner.qml
|
StatusBanner 0.1 StatusBanner.qml
|
||||||
StatusBaseButton 0.1 StatusBaseButton.qml
|
StatusBaseButton 0.1 StatusBaseButton.qml
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
<file>StatusQ/Components/qmldir</file>
|
<file>StatusQ/Components/qmldir</file>
|
||||||
<file>StatusQ/Controls/StatusActivityCenterButton.qml</file>
|
<file>StatusQ/Controls/StatusActivityCenterButton.qml</file>
|
||||||
<file>StatusQ/Controls/StatusAmountInput.qml</file>
|
<file>StatusQ/Controls/StatusAmountInput.qml</file>
|
||||||
|
<file>StatusQ/Controls/StatusAnimatedText.qml</file>
|
||||||
<file>StatusQ/Controls/StatusBackButton.qml</file>
|
<file>StatusQ/Controls/StatusBackButton.qml</file>
|
||||||
<file>StatusQ/Controls/StatusBanner.qml</file>
|
<file>StatusQ/Controls/StatusBanner.qml</file>
|
||||||
<file>StatusQ/Controls/StatusBaseButton.qml</file>
|
<file>StatusQ/Controls/StatusBaseButton.qml</file>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user