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 {
id: pageToolBar
title: `pages/${root.currentPage}Page.qml`
componentName: root.currentPage
figmaPagesCount: currentPageModelItem.object
? currentPageModelItem.object.figma.count : 0

View File

@ -5,7 +5,8 @@ import QtQuick.Layouts 1.14
ToolBar {
id: root
property string title
property string componentName
property int figmaPagesCount: 0
signal figmaPreviewClicked
@ -13,10 +14,12 @@ ToolBar {
RowLayout {
anchors.fill: parent
TextField {
Item {
Layout.fillWidth: true
}
text: root.title
TextField {
text: `pages/${root.componentName}Page.qml`
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
@ -25,6 +28,29 @@ ToolBar {
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 {}
ToolButton {