diff --git a/cypress/integration/common/report.js b/cypress/integration/common/report.js index 25f4c6e35..4bfc3c240 100644 --- a/cypress/integration/common/report.js +++ b/cypress/integration/common/report.js @@ -44,7 +44,7 @@ Given('I am logged in with a {string} role', role => { When('I click on "Report Post" from the content menu of the post', () => { cy.contains('.ds-card', davidIrvingPostTitle) - .find('.content-menu-trigger') + .find('.content-menu .base-button') .click({force: true}) cy.get('.popover .ds-menu-item-link') @@ -54,7 +54,7 @@ When('I click on "Report Post" from the content menu of the post', () => { When('I click on "Report User" from the content menu in the user info box', () => { cy.contains('.ds-card', davidIrvingPostTitle) - .get('.user-content-menu .content-menu-trigger') + .get('.user-content-menu .base-button') .click({ force: true }) cy.get('.popover .ds-menu-item-link') diff --git a/cypress/integration/common/settings.js b/cypress/integration/common/settings.js index 563d6a733..e8e968a5e 100644 --- a/cypress/integration/common/settings.js +++ b/cypress/integration/common/settings.js @@ -119,7 +119,7 @@ Then('they should be able to see my social media links', () => { }) When('I delete a social media link', () => { - cy.get("a[name='delete']") + cy.get(".base-button[title='Delete']") .click() }) @@ -129,7 +129,7 @@ Then('it gets deleted successfully', () => { }) When('I start editing a social media link', () => { - cy.get("a[name='edit']") + cy.get(".base-button[title='Edit']") .click() }) diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index c51c863d1..8e08be2cf 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -243,7 +243,7 @@ When("I type in the following text:", text => { }); Then("I select a category", () => { - cy.get("span") + cy.get(".base-button") .contains("Just for Fun") .click(); }); @@ -449,7 +449,7 @@ When("I ", name => { When( "I click on {string} from the content menu in the user info box", button => { - cy.get(".user-content-menu .content-menu-trigger").click(); + cy.get(".user-content-menu .base-button").click(); cy.get(".popover .ds-menu-item-link") .contains(button) .click({ diff --git a/webapp/assets/_new/styles/mixins/buttonStates.scss b/webapp/assets/_new/styles/mixins/buttonStates.scss new file mode 100644 index 000000000..b8e1509a6 --- /dev/null +++ b/webapp/assets/_new/styles/mixins/buttonStates.scss @@ -0,0 +1,65 @@ +@mixin buttonStates($color-scheme: primary, $filled: false) { + $main-color: $color-primary; + $active-color: $color-primary-dark; + $hover-color: $color-primary-light; + + @if $color-scheme == danger { + $main-color: $color-danger; + $active-color: $color-danger-dark; + $hover-color: $color-danger-light; + } + + color: $main-color; + border-color: $main-color; + background-color: transparent; + transition: background-color $duration-short; + + &:focus { + outline: $border-size-base dashed $main-color; + } + + &:enabled { + &:hover { + color: $color-neutral-100; + border-color: $main-color; + background-color: $main-color; + } + + &:active { + color: $color-neutral-100; + border-color: $active-color; + background-color: $active-color; + } + } + + &:disabled { + color: $color-neutral-60; + border-color: $color-neutral-60; + cursor: default; + } + + @if $filled { + color: $color-neutral-100; + border-color: $main-color; + background-color: $main-color; + + &:enabled { + &:hover { + border-color: $hover-color; + background-color: $hover-color; + } + + &:active { + color: $color-neutral-100; + border-color: $active-color; + background-color: $active-color; + } + } + + &:disabled { + color: $color-neutral-100; + background-color: $color-neutral-60; + border-color: $color-neutral-60; + } + } +} diff --git a/webapp/assets/_new/styles/tokens.scss b/webapp/assets/_new/styles/tokens.scss index 30a859980..36c6d8d5b 100644 --- a/webapp/assets/_new/styles/tokens.scss +++ b/webapp/assets/_new/styles/tokens.scss @@ -250,6 +250,21 @@ $size-avatar-base: 44px; $size-avatar-large: 64px; $size-avatar-x-large: 114px; +/** + * @tokens Size Buttons + * @presenter Spacing + */ + + $size-button-base: 36px; + $size-button-small: 26px; + +/** + * @tokens Size Buttons + * @presenter Spacing + */ + + $size-icon-base: 16px; + /** * @tokens Shadow * @presenter Shadow diff --git a/webapp/components/CategoriesSelect/CategoriesSelect.vue b/webapp/components/CategoriesSelect/CategoriesSelect.vue index 9ec8688c4..3e240e435 100644 --- a/webapp/components/CategoriesSelect/CategoriesSelect.vue +++ b/webapp/components/CategoriesSelect/CategoriesSelect.vue @@ -6,7 +6,7 @@ { it('calls `clear` method when the cancel button is clicked', async () => { wrapper.vm.updateEditorContent('ok') - await wrapper.find('.cancelBtn').trigger('submit') + await wrapper.find('[data-test="cancel-button"]').trigger('submit') expect(cancelMethodSpy).toHaveBeenCalledTimes(1) }) @@ -162,13 +162,13 @@ describe('CommentForm.vue', () => { describe('cancel button is clicked', () => { it('calls `closeEditWindow` method', async () => { wrapper.vm.updateEditorContent('ok') - await wrapper.find('.cancelBtn').trigger('submit') + await wrapper.find('[data-test="cancel-button"]').trigger('submit') expect(closeMethodSpy).toHaveBeenCalledTimes(1) }) it('emits `showEditCommentMenu` event', async () => { wrapper.vm.updateEditorContent('ok') - await wrapper.find('.cancelBtn').trigger('submit') + await wrapper.find('[data-test="cancel-button"]').trigger('submit') expect(wrapper.emitted('showEditCommentMenu')).toEqual([[false]]) }) }) diff --git a/webapp/components/CommentForm/CommentForm.vue b/webapp/components/CommentForm/CommentForm.vue index 88253065f..063a3d599 100644 --- a/webapp/components/CommentForm/CommentForm.vue +++ b/webapp/components/CommentForm/CommentForm.vue @@ -5,10 +5,15 @@
- + {{ $t('actions.cancel') }} - + {{ $t('post.comment.submit') }}
@@ -67,7 +72,6 @@ export default { this.$emit('showEditCommentMenu', false) }, handleCancel() { - console.log('handle cancel') if (!this.update) { this.clear() } else { diff --git a/webapp/components/CommentList/CommentList.spec.js b/webapp/components/CommentList/CommentList.spec.js index 0c037d2ff..064b8f136 100644 --- a/webapp/components/CommentList/CommentList.spec.js +++ b/webapp/components/CommentList/CommentList.spec.js @@ -63,12 +63,7 @@ describe('CommentList.vue', () => { it('displays a comments counter', () => { wrapper = Wrapper() - expect(wrapper.find('span.ds-tag').text()).toEqual('1') - }) - - it('displays a comments counter', () => { - wrapper = Wrapper() - expect(wrapper.find('span.ds-tag').text()).toEqual('1') + expect(wrapper.find('.count').text()).toEqual('1') }) describe('scrollToAnchor mixin', () => { diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index d67af69d9..97fc46e0d 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -82,14 +82,10 @@
- + {{ $t('actions.cancel') }} - + {{ $t('actions.save') }}
diff --git a/webapp/components/DeleteData/DeleteData.vue b/webapp/components/DeleteData/DeleteData.vue index 61ac8acfa..66a31205a 100644 --- a/webapp/components/DeleteData/DeleteData.vue +++ b/webapp/components/DeleteData/DeleteData.vue @@ -61,6 +61,7 @@ - {{ $t('donations.donate-now') }} + {{ $t('donations.donate-now') }} diff --git a/webapp/components/EnterNonce/EnterNonce.vue b/webapp/components/EnterNonce/EnterNonce.vue index d936544ad..eb44c3235 100644 --- a/webapp/components/EnterNonce/EnterNonce.vue +++ b/webapp/components/EnterNonce/EnterNonce.vue @@ -1,30 +1,27 @@ + + diff --git a/webapp/components/FilterMenu/FilterMenu.spec.js b/webapp/components/FilterMenu/FilterMenu.spec.js index 079ef5487..d70af323f 100644 --- a/webapp/components/FilterMenu/FilterMenu.spec.js +++ b/webapp/components/FilterMenu/FilterMenu.spec.js @@ -39,7 +39,7 @@ describe('FilterMenu.vue', () => { describe('click "clear-search-button" button', () => { it('emits clearSearch', () => { - wrapper.find({ name: 'clear-search-button' }).trigger('click') + wrapper.find('[name="clear-search-button"]').trigger('click') expect(wrapper.emitted().clearSearch).toHaveLength(1) }) }) diff --git a/webapp/components/FilterMenu/FilterMenu.vue b/webapp/components/FilterMenu/FilterMenu.vue index e4c689263..e56925e56 100644 --- a/webapp/components/FilterMenu/FilterMenu.vue +++ b/webapp/components/FilterMenu/FilterMenu.vue @@ -6,15 +6,16 @@
-
diff --git a/webapp/components/FilterPosts/CategoriesFilterMenuItems.vue b/webapp/components/FilterPosts/CategoriesFilterMenuItems.vue index 72835a660..9189f417d 100644 --- a/webapp/components/FilterPosts/CategoriesFilterMenuItems.vue +++ b/webapp/components/FilterPosts/CategoriesFilterMenuItems.vue @@ -12,10 +12,11 @@ - @@ -37,10 +38,11 @@ - diff --git a/webapp/components/FilterPosts/FilterPosts.spec.js b/webapp/components/FilterPosts/FilterPosts.spec.js index f27074b7b..c05a3d85f 100644 --- a/webapp/components/FilterPosts/FilterPosts.spec.js +++ b/webapp/components/FilterPosts/FilterPosts.spec.js @@ -92,7 +92,7 @@ describe('FilterPosts.vue', () => { it('starts with all categories button active', () => { const wrapper = openFilterPosts() allCategoriesButton = wrapper.findAll('button').at(1) - expect(allCategoriesButton.attributes().class).toContain('ds-button-primary') + expect(allCategoriesButton.attributes().class).toContain('--filled') }) it('calls TOGGLE_CATEGORY when clicked', () => { @@ -111,27 +111,27 @@ describe('FilterPosts.vue', () => { expect(mutations['posts/TOGGLE_LANGUAGE']).toHaveBeenCalledWith({}, 'en') }) - it('sets category button attribute `primary` when corresponding category is filtered', () => { + it('sets category button attribute `filled` when corresponding category is filtered', () => { getters['posts/filteredCategoryIds'] = jest.fn(() => ['cat9']) const wrapper = openFilterPosts() democracyAndPoliticsButton = wrapper.findAll('button').at(4) - expect(democracyAndPoliticsButton.attributes().class).toContain('ds-button-primary') + expect(democracyAndPoliticsButton.attributes().class).toContain('--filled') }) - it('sets language button attribute `primary` when corresponding language is filtered', () => { + it('sets language button attribute `filled` when corresponding language is filtered', () => { getters['posts/filteredLanguageCodes'] = jest.fn(() => ['es']) const wrapper = openFilterPosts() spanishButton = wrapper .findAll('button.language-buttons') .at(languages.findIndex(l => l.code === 'es')) - expect(spanishButton.attributes().class).toContain('ds-button-primary') + expect(spanishButton.attributes().class).toContain('--filled') }) - it('sets "filter-by-followed-authors-only" button attribute `primary`', () => { + it('sets "filter-by-followed-authors-only" button attribute `filled`', () => { getters['posts/filteredByUsersFollowed'] = jest.fn(() => true) const wrapper = openFilterPosts() expect( - wrapper.find({ name: 'filter-by-followed-authors-only' }).classes('ds-button-primary'), + wrapper.find('.base-button[name="filter-by-followed-authors-only"]').classes('--filled'), ).toBe(true) }) @@ -139,7 +139,7 @@ describe('FilterPosts.vue', () => { let wrapper beforeEach(() => { wrapper = openFilterPosts() - wrapper.find({ name: 'filter-by-followed-authors-only' }).trigger('click') + wrapper.find('.base-button[name="filter-by-followed-authors-only"]').trigger('click') }) it('calls TOGGLE_FILTER_BY_FOLLOWED', () => { diff --git a/webapp/components/FilterPosts/FilterPosts.vue b/webapp/components/FilterPosts/FilterPosts.vue index b83e99fd8..787751004 100644 --- a/webapp/components/FilterPosts/FilterPosts.vue +++ b/webapp/components/FilterPosts/FilterPosts.vue @@ -1,15 +1,15 @@ diff --git a/webapp/components/Modal/ReportModal.vue b/webapp/components/Modal/ReportModal.vue index 00fed2646..f6aca5f86 100644 --- a/webapp/components/Modal/ReportModal.vue +++ b/webapp/components/Modal/ReportModal.vue @@ -29,12 +29,13 @@ @@ -161,7 +162,7 @@ export default { .ds-modal { max-width: 600px !important; } -.ds-radio-option:not(.ds-button) { +.ds-radio-option { width: 100% !important; } .ds-radio-option-label { diff --git a/webapp/components/NotificationMenu/NotificationMenu.spec.js b/webapp/components/NotificationMenu/NotificationMenu.spec.js index 01c972d05..8020c8bb4 100644 --- a/webapp/components/NotificationMenu/NotificationMenu.spec.js +++ b/webapp/components/NotificationMenu/NotificationMenu.spec.js @@ -1,11 +1,11 @@ -import { config, shallowMount } from '@vue/test-utils' +import { config, mount } from '@vue/test-utils' import NotificationMenu from './NotificationMenu' const localVue = global.localVue localVue.filter('truncate', string => string) -config.stubs.dropdown = '' +config.stubs.dropdown = '' describe('NotificationMenu.vue', () => { let wrapper @@ -22,9 +22,9 @@ describe('NotificationMenu.vue', () => { } }) - describe('shallowMount', () => { + describe('mount', () => { const Wrapper = () => { - return shallowMount(NotificationMenu, { + return mount(NotificationMenu, { data, mocks, localVue, @@ -33,7 +33,7 @@ describe('NotificationMenu.vue', () => { it('counter displays 0', () => { wrapper = Wrapper() - expect(wrapper.find('ds-button-stub').text()).toEqual('0') + expect(wrapper.find('.count').text()).toEqual('0') }) it('no dropdown is rendered', () => { @@ -67,12 +67,12 @@ describe('NotificationMenu.vue', () => { it('counter displays 0', () => { wrapper = Wrapper() - expect(wrapper.find('ds-button-stub').text()).toEqual('0') + expect(wrapper.find('.count').text()).toEqual('0') }) - it('button is not primary', () => { + it('counter is not colored', () => { wrapper = Wrapper() - expect(wrapper.find('ds-button-stub').props('primary')).toBe(false) + expect(wrapper.find('.count').classes()).toContain('--inactive') }) }) @@ -130,12 +130,12 @@ describe('NotificationMenu.vue', () => { it('displays the number of unread notifications', () => { wrapper = Wrapper() - expect(wrapper.find('ds-button-stub').text()).toEqual('2') + expect(wrapper.find('.count').text()).toEqual('2') }) - it('renders primary button', () => { + it('renders the counter in red', () => { wrapper = Wrapper() - expect(wrapper.find('ds-button-stub').props('primary')).toBe(true) + expect(wrapper.find('.count').classes()).toContain('--danger') }) }) }) diff --git a/webapp/components/NotificationMenu/NotificationMenu.vue b/webapp/components/NotificationMenu/NotificationMenu.vue index 413102915..a3b085db9 100644 --- a/webapp/components/NotificationMenu/NotificationMenu.vue +++ b/webapp/components/NotificationMenu/NotificationMenu.vue @@ -1,12 +1,12 @@ diff --git a/webapp/pages/settings/embeds.vue b/webapp/pages/settings/embeds.vue index d842dbef0..22050c636 100644 --- a/webapp/pages/settings/embeds.vue +++ b/webapp/pages/settings/embeds.vue @@ -16,12 +16,12 @@ {{ $t('settings.embeds.status.change.question') }} - + {{ $t('settings.embeds.status.change.deny') }} - - +
+ {{ $t('settings.embeds.status.change.allow') }} - +

{{ $t('settings.embeds.info-description') }}

    diff --git a/webapp/pages/settings/index.vue b/webapp/pages/settings/index.vue index c37c27a1d..20034d5af 100644 --- a/webapp/pages/settings/index.vue +++ b/webapp/pages/settings/index.vue @@ -31,9 +31,9 @@ :placeholder="$t('settings.data.labelBio')" /> diff --git a/webapp/pages/settings/my-email-address/enter-nonce.vue b/webapp/pages/settings/my-email-address/enter-nonce.vue index 85755953a..91b2e269f 100644 --- a/webapp/pages/settings/my-email-address/enter-nonce.vue +++ b/webapp/pages/settings/my-email-address/enter-nonce.vue @@ -17,9 +17,9 @@ /> diff --git a/webapp/pages/settings/my-email-address/index.vue b/webapp/pages/settings/my-email-address/index.vue index 8b3889b0d..4e01bbb44 100644 --- a/webapp/pages/settings/my-email-address/index.vue +++ b/webapp/pages/settings/my-email-address/index.vue @@ -19,9 +19,9 @@ {{ backendErrors.message }} - + {{ $t('actions.save') }} - + diff --git a/webapp/pages/settings/my-social-media.spec.js b/webapp/pages/settings/my-social-media.spec.js index b1c9e0649..cf994e397 100644 --- a/webapp/pages/settings/my-social-media.spec.js +++ b/webapp/pages/settings/my-social-media.spec.js @@ -119,11 +119,11 @@ describe('my-social-media.vue', () => { }) it('displays the edit button', () => { - expect(wrapper.find('a[name="edit"]').exists()).toBe(true) + expect(wrapper.find('.base-button[data-test="edit-button"]').exists()).toBe(true) }) it('displays the delete button', () => { - expect(wrapper.find('a[name="delete"]').exists()).toBe(true) + expect(wrapper.find('.base-button[data-test="delete-button"]').exists()).toBe(true) }) }) @@ -138,7 +138,7 @@ describe('my-social-media.vue', () => { describe('editing social media link', () => { beforeEach(() => { - const editButton = wrapper.find('a[name="edit"]') + const editButton = wrapper.find('.base-button[data-test="edit-button"]') editButton.trigger('click') input = wrapper.find('input#editSocialMedia') }) @@ -169,7 +169,7 @@ describe('my-social-media.vue', () => { describe('deleting social media link', () => { beforeEach(() => { - const deleteButton = wrapper.find('a[name="delete"]') + const deleteButton = wrapper.find('.base-button[data-test="delete-button"]') deleteButton.trigger('click') }) diff --git a/webapp/pages/settings/my-social-media.vue b/webapp/pages/settings/my-social-media.vue index 677c4423d..6ed2f1bc6 100644 --- a/webapp/pages/settings/my-social-media.vue +++ b/webapp/pages/settings/my-social-media.vue @@ -24,22 +24,22 @@ {{ link.url }} | - - - - - - + + @@ -54,12 +54,12 @@ :placeholder="$t('settings.social-media.placeholder')" /> - + {{ editingLink.id ? $t('actions.save') : $t('settings.social-media.submit') }} - - + + {{ $t('actions.cancel') }} - + @@ -226,5 +226,10 @@ export default { .ds-list-item-prefix { align-self: center; } + + .ds-list-item-content { + display: flex; + align-items: center; + } } diff --git a/webapp/pages/settings/privacy.vue b/webapp/pages/settings/privacy.vue index 3decdefbe..f759926b7 100644 --- a/webapp/pages/settings/privacy.vue +++ b/webapp/pages/settings/privacy.vue @@ -4,7 +4,7 @@ - {{ $t('actions.save') }} + {{ $t('actions.save') }} diff --git a/webapp/pages/terms-and-conditions-confirm.vue b/webapp/pages/terms-and-conditions-confirm.vue index 24af8a23d..0716048b5 100644 --- a/webapp/pages/terms-and-conditions-confirm.vue +++ b/webapp/pages/terms-and-conditions-confirm.vue @@ -2,11 +2,11 @@

    - - + + {{ $t(`termsAndConditions.termsAndConditionsNewConfirmText`) }} - - + +

    @@ -17,7 +17,9 @@
    diff --git a/webapp/storybook/config.js b/webapp/storybook/config.js index 60b61d787..576136f92 100644 --- a/webapp/storybook/config.js +++ b/webapp/storybook/config.js @@ -2,6 +2,7 @@ import { addParameters, configure } from '@storybook/vue' import Vue from 'vue' import Vuex from 'vuex' import { action } from '@storybook/addon-actions' +// eslint-disable-next-line import/no-webpack-loader-syntax import '!style-loader!css-loader!sass-loader!../assets/_new/styles/resets.scss' Vue.use(Vuex) @@ -60,7 +61,7 @@ addParameters({ options: { storySort: (a, b) => a[1].kind === b[1].kind ? 0 : a[1].id.localeCompare(b[1].id, { numeric: true }), - } + }, }) configure(loadStories, module)