Skip to content

Commit 073b3ee

Browse files
Merge pull request #639 from joweecaquicla/636-add-tooltip-with-viewport-label-description
#636: Responsive breakpoint switcher - add tooltip with viewport label and description
2 parents c3364c4 + 41e6086 commit 073b3ee

File tree

6 files changed

+49
-5
lines changed

6 files changed

+49
-5
lines changed

app/code/Magento/PageBuilder/Component/Form/Element/Wysiwyg.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Wysiwyg extends \Magento\Ui\Component\Form\Element\Wysiwyg
4242
* @param ViewConfigInterface $viewConfig
4343
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
4444
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
45+
* @SuppressWarnings(PHPMD.NPathComplexity)
4546
* @throws \Magento\Framework\Exception\NoSuchEntityException
4647
*/
4748
public function __construct(
@@ -90,7 +91,7 @@ public function __construct(
9091
$wysiwygConfigData['viewports'] = $viewConfig->getViewConfig()->getVarValue(
9192
'Magento_PageBuilder',
9293
'breakpoints'
93-
);;
94+
);
9495

9596
if ($overrideSnapshot) {
9697
$pageBuilderConfig = $pageBuilderConfig ?: ObjectManager::getInstance()->get(PageBuilderConfig::class);

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_page-builder.less

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@
2323
opacity: 1;
2424
visibility: visible;
2525
}
26+
27+
.tooltip {
28+
margin-left: 0;
29+
.tooltip-content {
30+
background: rgba(49, 48, 43, .8);
31+
font-size: 12px;
32+
padding: 7px 9px;
33+
text-align: left;
34+
35+
&:before {
36+
opacity: .65;
37+
}
38+
39+
.tooltip-label {
40+
font-weight: bold;
41+
}
42+
}
43+
}
2644
}
2745

2846
.admin__fieldset > .admin__field > .admin__control-grouped {

app/code/Magento/PageBuilder/view/adminhtml/web/js/page-builder.js

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/template/page-builder.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
<div class="admin__field pagebuilder-header"
1313
css="visible: panel.isVisible(), 'transition-out': isSnapshotTransition()"
1414
if="!isSnapshot()">
15-
<each args="data: Object.keys(viewports), as: 'name'">
16-
<button type="button" translate="$parent.viewports[name].label" disable="name === $parent.viewport()" click="$parent.toggleViewport.bind($parent, name)"/>
17-
</each>
15+
<!-- ko template: viewportTemplate --><!-- /ko -->
1816
<button type="button" translate="'Apply Template'" if="isAllowedTemplateApply" click="toggleTemplateManger"/>
1917
<button type="button" translate="'Save as Template'" if="isAllowedTemplateSave" click="saveAsTemplate"/>
2018
<i click="toggleFullScreen.bind($data, {animate:true})"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<each args="data: Object.keys(viewports), as: 'name'">
8+
<span class="tooltip">
9+
<button type="button" translate="$parent.viewports[name].label" disable="name === $parent.viewport()" click="$parent.toggleViewport.bind($parent, name)"/>
10+
<span class="tooltip-content">
11+
<span class="tooltip-label" translate="$parent.viewports[name].label"/><br/>
12+
<span translate="'View your content for '"/><text args="name"/><br/>
13+
<span translate="'Width'"/>: <text args="Object.values($parent.viewports[name].conditions)[0]"/>
14+
</span>
15+
</span>
16+
</each>

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/page-builder.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ export default class PageBuilder implements PageBuilderInterface {
223223
return this.template;
224224
}
225225

226+
get viewportTemplate(): string {
227+
return "Magento_PageBuilder/viewport/switcher";
228+
}
229+
226230
/**
227231
* Toggle template manager
228232
*/

0 commit comments

Comments
 (0)