Commit 60b799d6 authored by Taurie Davis's avatar Taurie Davis

Fix layout, spacing, and style of reaction emoji on issuables

Standardizes spacing between emojis, button categories and
selected states, emoji button height, and surrounding
button layout for better responsive behavior.

Changelog: fixed
parent 491b3893
...@@ -32,7 +32,7 @@ export default (el) => { ...@@ -32,7 +32,7 @@ export default (el) => {
canAwardEmoji: this.canAwardEmoji, canAwardEmoji: this.canAwardEmoji,
currentUserId: this.currentUserId, currentUserId: this.currentUserId,
defaultAwards: ['thumbsup', 'thumbsdown'], defaultAwards: ['thumbsup', 'thumbsdown'],
selectedClass: 'gl-bg-blue-50! is-active', selectedClass: 'selected',
}, },
on: { on: {
award: this.toggleAward, award: this.toggleAward,
......
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
:boundary="getBoundaryElement()" :boundary="getBoundaryElement()"
:class="dropdownClass" :class="dropdownClass"
menu-class="dropdown-extended-height" menu-class="dropdown-extended-height"
category="tertiary" category="secondary"
no-flip no-flip
right right
lazy lazy
......
...@@ -304,7 +304,7 @@ export default { ...@@ -304,7 +304,7 @@ export default {
v-else v-else
v-gl-tooltip v-gl-tooltip
:class="{ 'js-user-authored': isAuthoredByCurrentUser }" :class="{ 'js-user-authored': isAuthoredByCurrentUser }"
class="note-action-button note-emoji-button add-reaction-button btn-icon js-add-award js-note-emoji" class="note-action-button note-emoji-button add-reaction-button js-add-award js-note-emoji"
category="tertiary" category="tertiary"
variant="default" variant="default"
:title="$options.i18n.addReactionLabel" :title="$options.i18n.addReactionLabel"
......
...@@ -173,7 +173,7 @@ export default { ...@@ -173,7 +173,7 @@ export default {
v-for="awardList in groupedAwards" v-for="awardList in groupedAwards"
:key="awardList.name" :key="awardList.name"
v-gl-tooltip.viewport v-gl-tooltip.viewport
class="gl-mr-3" class="gl-mr-3 gl-my-2"
:class="awardList.classes" :class="awardList.classes"
:title="awardList.title" :title="awardList.title"
data-testid="award-button" data-testid="award-button"
...@@ -184,10 +184,10 @@ export default { ...@@ -184,10 +184,10 @@ export default {
</template> </template>
<span class="js-counter">{{ awardList.list.length }}</span> <span class="js-counter">{{ awardList.list.length }}</span>
</gl-button> </gl-button>
<div v-if="canAwardEmoji" class="award-menu-holder"> <div v-if="canAwardEmoji" class="award-menu-holder gl-my-2">
<emoji-picker <emoji-picker
v-if="glFeatures.improvedEmojiPicker" v-if="glFeatures.improvedEmojiPicker"
:toggle-class="['add-reaction-button gl-relative!', { 'is-active': isMenuOpen }]" :toggle-class="['add-reaction-button btn-icon gl-relative!', { 'is-active': isMenuOpen }]"
@click="handleAward" @click="handleAward"
@shown="setIsMenuOpen(true)" @shown="setIsMenuOpen(true)"
@hidden="setIsMenuOpen(false)" @hidden="setIsMenuOpen(false)"
......
...@@ -255,27 +255,9 @@ ...@@ -255,27 +255,9 @@
// This forces the height and width of the inner content to match // This forces the height and width of the inner content to match
// other gl-buttons despite all child elements being set to // other gl-buttons despite all child elements being set to
// `position:absolute` // `position:absolute`
&::after {
content: '\a0';
display: block !important;
width: 1em;
color: transparent;
}
.reaction-control-icon {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
// center the icon vertically and horizontally within the button
display: flex;
align-items: center;
justify-content: center;
@include transition(opacity, transform);
.reaction-control-icon {
.gl-icon { .gl-icon {
height: $default-icon-size; height: $default-icon-size;
width: $default-icon-size; width: $default-icon-size;
...@@ -283,32 +265,26 @@ ...@@ -283,32 +265,26 @@
} }
.reaction-control-icon-neutral { .reaction-control-icon-neutral {
opacity: 1; display: flex;
} }
.reaction-control-icon-positive, .reaction-control-icon-positive,
.reaction-control-icon-super-positive { .reaction-control-icon-super-positive {
opacity: 0; display: none;
} }
&:hover, &:hover,
&.active, &.active,
&:active, &:active,
&.is-active { &.is-active {
// extra specificty added to override another selector
.reaction-control-icon .gl-icon {
color: $blue-500;
transform: scale(1.15);
}
.reaction-control-icon-neutral { .reaction-control-icon-neutral {
opacity: 0; display: none;
} }
} }
&:hover { &:hover {
.reaction-control-icon-positive { .reaction-control-icon-positive {
opacity: 1; display: flex;
} }
} }
...@@ -316,11 +292,11 @@ ...@@ -316,11 +292,11 @@
&:active, &:active,
&.is-active { &.is-active {
.reaction-control-icon-positive { .reaction-control-icon-positive {
opacity: 0; display: none;
} }
.reaction-control-icon-super-positive { .reaction-control-icon-super-positive {
opacity: 1; display: flex;
} }
} }
...@@ -336,17 +312,13 @@ ...@@ -336,17 +312,13 @@
} }
.reaction-control-icon-neutral { .reaction-control-icon-neutral {
opacity: 1; display: flex;
} }
.reaction-control-icon-positive, .reaction-control-icon-positive,
.reaction-control-icon-super-positive { .reaction-control-icon-super-positive {
opacity: 0; display: none;
} }
} }
} }
} }
.awards .is-active {
box-shadow: inset 0 0 0 1px $blue-200;
}
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
} }
&.content-component-block { &.content-component-block {
padding: 11px 0; padding: 8px 0;
background-color: $body-bg; background-color: $body-bg;
} }
...@@ -253,7 +253,7 @@ ...@@ -253,7 +253,7 @@
} }
.content-block-small { .content-block-small {
padding: 10px 0; padding: 4px 0;
} }
.landing { .landing {
......
...@@ -67,10 +67,6 @@ ...@@ -67,10 +67,6 @@
.emoji-block { .emoji-block {
padding: $gl-padding-4 0; padding: $gl-padding-4 0;
@include media-breakpoint-down(md) {
padding: $gl-padding-8 0;
}
} }
} }
......
...@@ -130,10 +130,6 @@ ul.related-merge-requests > li { ...@@ -130,10 +130,6 @@ ul.related-merge-requests > li {
&:not(:only-child) { &:not(:only-child) {
margin-right: $gl-padding-8; margin-right: $gl-padding-8;
} }
@include media-breakpoint-down(md) {
margin-top: $gl-padding-8;
}
} }
} }
...@@ -154,10 +150,6 @@ ul.related-merge-requests > li { ...@@ -154,10 +150,6 @@ ul.related-merge-requests > li {
.btn-group:not(.hidden) { .btn-group:not(.hidden) {
display: flex; display: flex;
@include media-breakpoint-down(md) {
margin-top: $gl-padding-8;
}
} }
.js-create-merge-request { .js-create-merge-request {
......
.content-block.content-block-small.emoji-list-container.js-noteable-awards .content-block.emoji-block.emoji-list-container.js-noteable-awards
= render 'award_emoji/awards_block', awardable: @merge_request, inline: true, api_awards_path: award_emoji_merge_request_api_path(@merge_request) do = render 'award_emoji/awards_block', awardable: @merge_request, inline: true, api_awards_path: award_emoji_merge_request_api_path(@merge_request) do
.ml-auto.mt-auto.mb-auto .ml-auto.gl-my-2
#js-vue-sort-issue-discussions #js-vue-sort-issue-discussions
= render "projects/merge_requests/discussion_filter" = render "projects/merge_requests/discussion_filter"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
.row.gl-m-0.gl-justify-content-space-between .row.gl-m-0.gl-justify-content-space-between
.js-noteable-awards .js-noteable-awards
= render 'award_emoji/awards_block', awardable: issuable, inline: true, api_awards_path: api_awards_path = render 'award_emoji/awards_block', awardable: issuable, inline: true, api_awards_path: api_awards_path
.new-branch-col .new-branch-col.gl-my-2
= render_if_exists "projects/issues/timeline_toggle", issuable: issuable = render_if_exists "projects/issues/timeline_toggle", issuable: issuable
#js-vue-sort-issue-discussions #js-vue-sort-issue-discussions
#js-vue-discussion-filter{ data: { default_filter: current_user&.notes_filter_for(issuable), notes_filters: UserPreference.notes_filters.to_json } } #js-vue-discussion-filter{ data: { default_filter: current_user&.notes_filter_for(issuable), notes_filters: UserPreference.notes_filters.to_json } }
......
...@@ -62,11 +62,11 @@ RSpec.describe 'User interacts with awards' do ...@@ -62,11 +62,11 @@ RSpec.describe 'User interacts with awards' do
page.within('.awards') do page.within('.awards') do
expect(page).to have_selector('[data-testid="award-button"]') expect(page).to have_selector('[data-testid="award-button"]')
expect(page.find('[data-testid="award-button"].is-active .js-counter')).to have_content('1') expect(page.find('[data-testid="award-button"].selected .js-counter')).to have_content('1')
expect(page).to have_css('[data-testid="award-button"].is-active[title="You"]') expect(page).to have_css('[data-testid="award-button"].selected[title="You"]')
expect do expect do
page.find('[data-testid="award-button"].is-active').click page.find('[data-testid="award-button"].selected').click
wait_for_requests wait_for_requests
end.to change { page.all('[data-testid="award-button"]').size }.from(3).to(2) end.to change { page.all('[data-testid="award-button"]').size }.from(3).to(2)
end end
...@@ -205,7 +205,7 @@ RSpec.describe 'User interacts with awards' do ...@@ -205,7 +205,7 @@ RSpec.describe 'User interacts with awards' do
it 'adds award to issue' do it 'adds award to issue' do
first('[data-testid="award-button"]').click first('[data-testid="award-button"]').click
expect(page).to have_selector('[data-testid="award-button"].is-active') expect(page).to have_selector('[data-testid="award-button"].selected')
expect(first('[data-testid="award-button"]')).to have_content '1' expect(first('[data-testid="award-button"]')).to have_content '1'
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
...@@ -215,7 +215,7 @@ RSpec.describe 'User interacts with awards' do ...@@ -215,7 +215,7 @@ RSpec.describe 'User interacts with awards' do
it 'removes award from issue' do it 'removes award from issue' do
first('[data-testid="award-button"]').click first('[data-testid="award-button"]').click
find('[data-testid="award-button"].is-active').click find('[data-testid="award-button"].selected').click
expect(first('[data-testid="award-button"]')).to have_content '0' expect(first('[data-testid="award-button"]')).to have_content '0'
......
...@@ -18,7 +18,7 @@ RSpec.describe 'Merge request > User awards emoji', :js do ...@@ -18,7 +18,7 @@ RSpec.describe 'Merge request > User awards emoji', :js do
it 'adds award to merge request' do it 'adds award to merge request' do
first('[data-testid="award-button"]').click first('[data-testid="award-button"]').click
expect(page).to have_selector('[data-testid="award-button"].is-active') expect(page).to have_selector('[data-testid="award-button"].selected')
expect(first('[data-testid="award-button"]')).to have_content '1' expect(first('[data-testid="award-button"]')).to have_content '1'
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
...@@ -27,7 +27,7 @@ RSpec.describe 'Merge request > User awards emoji', :js do ...@@ -27,7 +27,7 @@ RSpec.describe 'Merge request > User awards emoji', :js do
it 'removes award from merge request' do it 'removes award from merge request' do
first('[data-testid="award-button"]').click first('[data-testid="award-button"]').click
find('[data-testid="award-button"].is-active').click find('[data-testid="award-button"].selected').click
expect(first('[data-testid="award-button"]')).to have_content '0' expect(first('[data-testid="award-button"]')).to have_content '0'
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
......
...@@ -5,7 +5,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -5,7 +5,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
class="awards js-awards-block" class="awards js-awards-block"
> >
<button <button
class="btn gl-mr-3 btn-default btn-md gl-button" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button"
data-testid="award-button" data-testid="award-button"
title="Ada, Leonardo, and Marie" title="Ada, Leonardo, and Marie"
type="button" type="button"
...@@ -35,7 +35,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -35,7 +35,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
</span> </span>
</button> </button>
<button <button
class="btn gl-mr-3 btn-default btn-md gl-button selected" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected"
data-testid="award-button" data-testid="award-button"
title="You, Ada, and Marie" title="You, Ada, and Marie"
type="button" type="button"
...@@ -65,7 +65,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -65,7 +65,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
</span> </span>
</button> </button>
<button <button
class="btn gl-mr-3 btn-default btn-md gl-button" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button"
data-testid="award-button" data-testid="award-button"
title="Ada and Jane" title="Ada and Jane"
type="button" type="button"
...@@ -95,7 +95,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -95,7 +95,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
</span> </span>
</button> </button>
<button <button
class="btn gl-mr-3 btn-default btn-md gl-button selected" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected"
data-testid="award-button" data-testid="award-button"
title="You, Ada, Jane, and Leonardo" title="You, Ada, Jane, and Leonardo"
type="button" type="button"
...@@ -125,7 +125,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -125,7 +125,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
</span> </span>
</button> </button>
<button <button
class="btn gl-mr-3 btn-default btn-md gl-button selected" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected"
data-testid="award-button" data-testid="award-button"
title="You" title="You"
type="button" type="button"
...@@ -155,7 +155,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -155,7 +155,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
</span> </span>
</button> </button>
<button <button
class="btn gl-mr-3 btn-default btn-md gl-button" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button"
data-testid="award-button" data-testid="award-button"
title="Marie" title="Marie"
type="button" type="button"
...@@ -185,7 +185,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -185,7 +185,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
</span> </span>
</button> </button>
<button <button
class="btn gl-mr-3 btn-default btn-md gl-button selected" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected"
data-testid="award-button" data-testid="award-button"
title="You" title="You"
type="button" type="button"
...@@ -216,7 +216,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -216,7 +216,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
</button> </button>
<div <div
class="award-menu-holder" class="award-menu-holder gl-my-2"
> >
<button <button
aria-label="Add reaction" aria-label="Add reaction"
......
...@@ -41,7 +41,14 @@ const TEST_AWARDS = [ ...@@ -41,7 +41,14 @@ const TEST_AWARDS = [
]; ];
const TEST_ADD_BUTTON_CLASS = 'js-test-add-button-class'; const TEST_ADD_BUTTON_CLASS = 'js-test-add-button-class';
const REACTION_CONTROL_CLASSES = ['btn', 'gl-mr-3', 'btn-default', 'btn-md', 'gl-button']; const REACTION_CONTROL_CLASSES = [
'btn',
'gl-mr-3',
'gl-my-2',
'btn-default',
'btn-md',
'gl-button',
];
describe('vue_shared/components/awards_list', () => { describe('vue_shared/components/awards_list', () => {
let wrapper; let wrapper;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment