From aa0da37ed2bdacc39a5efdd2dcf5e8abe91a204d Mon Sep 17 00:00:00 2001 From: Mark Perkins Date: Thu, 20 Jul 2023 18:05:36 +0100 Subject: [PATCH] feat(embeds): add copy button to embed drawer toolbar re #490 --- .../lookbook/embed/inspector/component.html.erb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/components/lookbook/embed/inspector/component.html.erb b/app/components/lookbook/embed/inspector/component.html.erb index 1572aaa9f..876b64f64 100644 --- a/app/components/lookbook/embed/inspector/component.html.erb +++ b/app/components/lookbook/embed/inspector/component.html.erb @@ -82,6 +82,21 @@ <% end %> <% end %> <% end %> + + <% toolbar.with_section align: :right, class: "flex-none relative z-10" do %> + <%= lookbook_render :button_group do |group| %> + <%= panels.select { |p| !p.disabled && p.copy }.each do |panel| %> + <% group.with_button id: "copy-panel-contents-button-#{panel.name}", + icon: :copy, + tooltip: "Copy panel contents", + copy: !!panel.copy, + "x-show": "store.activeTab === '#{panel.name}'", + cloak: true do %> + <%= panel.copy ? panel.copy : "" %> + <% end %> + <% end %> + <% end %> + <% end %> <% end %>