-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EZP-31236: Added tooltips as new UI component #1176
Merged
lserwatka
merged 15 commits into
ezsystems:master
from
lucasOsti:EZP-31236-add-tooltips
Feb 24, 2020
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9f20003
EZP-31236 Restaled bootstrap tooltip
lucasOsti 4d94e8c
removed empty line in scss file
lucasOsti 4dde1fe
Added fixes after code review
lucasOsti 0a69030
Added changes after code review
lucasOsti ba01e0b
Added changes after code review
lucasOsti 504aa98
Added changes after code review
lucasOsti be249f5
[Behat] Adjusted selectors for changed element attributes
866b425
Added title tags to action buttons
lucasOsti 278675d
Fix CS build error
lucasOsti 87b8606
After code review
lucasOsti 8f1ab31
After code review
lucasOsti 5b04bf5
After code review
lucasOsti 08c272a
Moved title parameter to ez-data-source in inputs
lucasOsti e6ae6f5
after QA
lucasOsti b58dbd3
Fixed hidden of tooltips
lucasOsti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
3 changes: 3 additions & 0 deletions
3
src/bundle/Resources/public/js/scripts/core/custom.tooltip.js
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,3 @@ | ||
(function(global, doc, eZ) { | ||
eZ.helpers.tooltips.parse(); | ||
})(window, window.document, window.eZ); |
38 changes: 38 additions & 0 deletions
38
src/bundle/Resources/public/js/scripts/helpers/tooltips.helper.js
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,38 @@ | ||
(function(global, doc, eZ, $) { | ||
const TOOLTIPS_SELECTOR = '[title]'; | ||
const parse = () => { | ||
const tooltipsNode = doc.querySelectorAll(TOOLTIPS_SELECTOR); | ||
|
||
for (tooltipNode of tooltipsNode) { | ||
if (tooltipNode.title) { | ||
const delay = { | ||
show: tooltipNode.dataset.delayShow || 150, | ||
hide: tooltipNode.dataset.delayHide || 75, | ||
}; | ||
const extraClasses = tooltipNode.dataset.extraClasses || ''; | ||
const placement = tooltipNode.dataset.placement || 'bottom'; | ||
|
||
$(tooltipNode).tooltip({ | ||
delay, | ||
placement, | ||
template: `<div class="tooltip ez-tooltip ${extraClasses}"> | ||
<div class="arrow ez-tooltip__arrow"></div> | ||
<div class="tooltip-inner ez-tooltip__inner"></div> | ||
</div>`, | ||
}); | ||
} | ||
} | ||
}; | ||
const hideAll = () => { | ||
const tooltipsNode = doc.querySelectorAll(TOOLTIPS_SELECTOR); | ||
|
||
for (tooltipNode of tooltipsNode) { | ||
$(tooltipNode).tooltip('hide'); | ||
} | ||
}; | ||
|
||
eZ.addConfig('helpers.tooltips', { | ||
parse, | ||
hideAll, | ||
}); | ||
})(window, window.document, window.eZ, window.jQuery); |
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
57 changes: 57 additions & 0 deletions
57
src/bundle/Resources/public/scss/core/_custom.tooltip.scss
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,57 @@ | ||
.ez-tooltip { | ||
&.show { | ||
opacity: 1 | ||
} | ||
|
||
&.bs-tooltip-top &__arrow { | ||
GrabowskiM marked this conversation as resolved.
Show resolved
Hide resolved
|
||
height: calculateRem(8px); | ||
|
||
&::before { | ||
border-top-color: $ez-white; | ||
} | ||
} | ||
|
||
&.bs-tooltip-right &__arrow { | ||
width: calculateRem(8px); | ||
|
||
&::before { | ||
border-right-color: $ez-white; | ||
} | ||
} | ||
|
||
&.bs-tooltip-bottom &__arrow { | ||
height: calculateRem(8px); | ||
|
||
&::before { | ||
border-bottom-color: $ez-white; | ||
} | ||
} | ||
|
||
&.bs-tooltip-left &__arrow { | ||
width: calculateRem(8px); | ||
|
||
&::before { | ||
border-left-color: $ez-white; | ||
} | ||
} | ||
|
||
&__inner { | ||
padding: calulateRem(4px) calcuateRem(10px); | ||
max-width: calculateRem(250px); | ||
border: calculateRem(1px) solid $ez-ground-base-dark; | ||
border-radius: calculateRem(4px); | ||
background-color: $ez-white; | ||
color: $ez-black; | ||
font-size: calculateRem(11px); | ||
font-weight: 700; | ||
text-align: left; | ||
line-height: calculateRem(14px); | ||
box-shadow: 0 calculateRem(4px) calculateRem(6px) rgba(135, 135, 135, 0.35); | ||
} | ||
|
||
&--medium &__inner { | ||
padding: calculateRem(8px) calculateRem(16px); | ||
font-size: calculateRem(13px); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default is 16px and big is 13px. |
||
line-height: calculateRem(15px); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if helper itself should invoke the method.
The helper should be included with other helpers but invoked in the other file so we could move it as needed.