-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(StatusCheckBox/Switch): UI updates & some fixes
- fix a bug where the Switch would start animating if it'd been checked on creation - add the same property `leftSide` to StatusSwitch (just like StatusCheckBox), and use `LayoutMirroring` to perform the visual inversion - fixup margins and padding, removing hardcoded values, according to latest Figma designs - make a difference between a disabled and inactive button by using opacity - provide smooth color transitions - add dedicated StoryBook pages
- Loading branch information
Showing
4 changed files
with
184 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Controls 2.15 | ||
import QtQuick.Layouts 1.15 | ||
|
||
import StatusQ.Controls 0.1 | ||
|
||
import Storybook 1.0 | ||
|
||
SplitView { | ||
id: root | ||
|
||
orientation: Qt.Vertical | ||
Logs { id: logs } | ||
|
||
Item { | ||
SplitView.fillWidth: true | ||
SplitView.fillHeight: true | ||
|
||
Rectangle { | ||
width: switchControl.width | ||
height: switchControl.height | ||
anchors.centerIn: parent | ||
color: "transparent" | ||
border.width: 1 | ||
border.color: "pink" | ||
|
||
StatusCheckBox { | ||
id: switchControl | ||
anchors.centerIn: parent | ||
text: ctrlWithText.checked ? "Check me out" : "" | ||
leftSide: !ctrlInverted.checked | ||
changeCursor: ctrlCursor.checked | ||
checked: true | ||
enabled: ctrlEnabled.checked | ||
tristate: ctrlTristate.checked | ||
size: ctrlSmall.checked ? StatusCheckBox.Size.Small : StatusCheckBox.Size.Regular | ||
onClicked: logs.logEvent("clicked()") | ||
onToggled: logs.logEvent("toggled()") | ||
} | ||
} | ||
} | ||
|
||
LogsAndControlsPanel { | ||
SplitView.minimumHeight: 320 | ||
SplitView.preferredHeight: 320 | ||
|
||
logsView.logText: logs.logText | ||
|
||
ColumnLayout { | ||
Layout.fillWidth: true | ||
|
||
Switch { | ||
id: ctrlEnabled | ||
text: "Enabled" | ||
checked: true | ||
} | ||
Switch { | ||
id: ctrlCursor | ||
text: "Change cursor" | ||
checked: true | ||
} | ||
Switch { | ||
id: ctrlInverted | ||
text: "Inverted" | ||
} | ||
Switch { | ||
id: ctrlSmall | ||
text: "Small size" | ||
} | ||
Switch { | ||
id: ctrlTristate | ||
text: "Tristate" | ||
} | ||
Switch { | ||
id: ctrlWithText | ||
text: "With text" | ||
checked: true | ||
} | ||
} | ||
} | ||
} | ||
|
||
// category: Controls | ||
// status: good |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Controls 2.15 | ||
import QtQuick.Layouts 1.15 | ||
|
||
import StatusQ.Controls 0.1 | ||
|
||
import Storybook 1.0 | ||
|
||
SplitView { | ||
id: root | ||
|
||
orientation: Qt.Vertical | ||
Logs { id: logs } | ||
|
||
Item { | ||
SplitView.fillWidth: true | ||
SplitView.fillHeight: true | ||
|
||
Rectangle { | ||
width: switchControl.width | ||
height: switchControl.height | ||
anchors.centerIn: parent | ||
color: "transparent" | ||
border.width: 1 | ||
border.color: "pink" | ||
|
||
StatusSwitch { | ||
id: switchControl | ||
anchors.centerIn: parent | ||
text: ctrlWithText.checked ? "Check me out" : "" | ||
leftSide: !ctrlInverted.checked | ||
checked: true | ||
enabled: ctrlEnabled.checked | ||
onClicked: logs.logEvent("clicked()") | ||
onToggled: logs.logEvent("toggled()") | ||
} | ||
} | ||
} | ||
|
||
LogsAndControlsPanel { | ||
SplitView.minimumHeight: 200 | ||
SplitView.preferredHeight: 200 | ||
|
||
logsView.logText: logs.logText | ||
|
||
ColumnLayout { | ||
Layout.fillWidth: true | ||
|
||
Switch { | ||
id: ctrlEnabled | ||
text: "Enabled" | ||
checked: true | ||
} | ||
Switch { | ||
id: ctrlInverted | ||
text: "Inverted" | ||
} | ||
Switch { | ||
id: ctrlWithText | ||
text: "With text" | ||
checked: true | ||
} | ||
} | ||
} | ||
} | ||
|
||
// category: Controls | ||
// status: good |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters