From 59b6595a413c7e5ded4c277ba96f65bc9fe07195 Mon Sep 17 00:00:00 2001 From: Kasper Nilsson Date: Mon, 14 May 2018 17:44:10 -0700 Subject: [PATCH] Icons for change actions Makes change actions flat buttons instead of raised ones and provides icons for them. Bug: Issue 8796 Change-Id: I6e2652e14f25f1828afecbac181248c7c0ec1cf0 --- .../gr-change-actions/gr-change-actions.html | 33 +++++++++++++++---- .../gr-change-actions/gr-change-actions.js | 28 +++++++++++++++- .../elements/shared/gr-icons/gr-icons.html | 27 +++++++++++++-- 3 files changed, 79 insertions(+), 9 deletions(-) diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.html b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.html index 62e9033017..6913f988d5 100644 --- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.html +++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.html @@ -25,6 +25,7 @@ limitations under the License. + @@ -61,6 +62,18 @@ limitations under the License. margin: 1em; text-align: center; } + iron-icon { + color: var(--default-button-text-color); + height: 1.2rem; + margin-right: .2rem; + width: 1.2rem; + } + #moreActions iron-icon { + margin: 0; + } + .hidden { + display: none; + } @media screen and (max-width: 50em) { #mainContent, section, @@ -96,14 +109,17 @@ limitations under the License. items="[[_topLevelPrimaryActions]]" as="action"> [[action.label]] + on-tap="_handleActionTap"> + + [[action.label]] +
[[action.label]] + on-tap="_handleActionTap"> + + [[action.label]] +
Loading actions... More + items="[[_menuActions]]"> + + { + if (ACTIONS_WITH_ICONS.has(action.__key)) { + action.icon = action.__key; + } + return action; + }); }, _getActionPriority(action) { @@ -1386,5 +1408,9 @@ _computeHasTooltip(title) { return !!title; }, + + _computeHasIcon(action) { + return action.icon ? '' : 'hidden'; + }, }); })(); diff --git a/polygerrit-ui/app/elements/shared/gr-icons/gr-icons.html b/polygerrit-ui/app/elements/shared/gr-icons/gr-icons.html index cbae987637..c19e3d590e 100644 --- a/polygerrit-ui/app/elements/shared/gr-icons/gr-icons.html +++ b/polygerrit-ui/app/elements/shared/gr-icons/gr-icons.html @@ -40,6 +40,12 @@ limitations under the License. + + + + + + @@ -51,8 +57,25 @@ limitations under the License. - - + + + + + + + + + + + + + + + + + + +