feat(Storybook): Add button for copying component name to clipboard

Closes: #9673
This commit is contained in:
Michał Cieślak 2023-02-28 21:58:39 +01:00 committed by Michał
parent 18e5fc915c
commit 4d5d557dfd
2 changed files with 30 additions and 4 deletions

View File

@ -136,7 +136,7 @@ ApplicationWindow {
footer: PageToolBar { footer: PageToolBar {
id: pageToolBar id: pageToolBar
title: `pages/${root.currentPage}Page.qml` componentName: root.currentPage
figmaPagesCount: currentPageModelItem.object figmaPagesCount: currentPageModelItem.object
? currentPageModelItem.object.figma.count : 0 ? currentPageModelItem.object.figma.count : 0

View File

@ -5,7 +5,8 @@ import QtQuick.Layouts 1.14
ToolBar { ToolBar {
id: root id: root
property string title property string componentName
property int figmaPagesCount: 0 property int figmaPagesCount: 0
signal figmaPreviewClicked signal figmaPreviewClicked
@ -13,10 +14,12 @@ ToolBar {
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
TextField { Item {
Layout.fillWidth: true Layout.fillWidth: true
}
text: root.title TextField {
text: `pages/${root.componentName}Page.qml`
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
@ -25,6 +28,29 @@ ToolBar {
background: null background: null
} }
ToolButton {
text: "📋"
ToolTip.timeout: 2000
ToolTip.text: "Component name copied to the clipboard"
TextInput {
id: hiddenTextInput
text: root.componentName
visible: false
}
onClicked: {
hiddenTextInput.selectAll()
hiddenTextInput.copy()
ToolTip.visible = true
}
}
Item {
Layout.fillWidth: true
}
ToolSeparator {} ToolSeparator {}
ToolButton { ToolButton {