Skip to content
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

refactor(styleguide): migrate and redesign buttons #2562

Merged
merged 35 commits into from
Jan 15, 2020

Conversation

alina-beck
Copy link
Collaborator

@alina-beck alina-beck commented Dec 18, 2019

🍰 Pullrequest

  • Migration of styleguide buttons + improved code and functionality + design changes
  • Migration of styleguide spinner (because it is used in the buttons)
  • Refactoring of the CounterIcon (because it was wrapped around a button but I would argue it should be the other way round 😉)

Old buttons
Screenshot 2019-12-18 at 12 21 13
Screenshot 2019-12-18 at 12 22 41
Screenshot 2019-12-18 at 12 25 48

New buttons
Screenshot 2019-12-18 at 12 23 20
Screenshot 2019-12-18 at 12 23 30
Screenshot 2019-12-18 at 12 23 43
Screenshot 2019-12-18 at 12 23 54
Screenshot 2019-12-18 at 12 24 02

Please start storybook to see them in action!

Motivation

  • I got rid of the secondary button because it is never used on the site and would disrupt the design in its current state. I don't think we need the blue color at all.
  • I changed the design of the default button because with grey text on grey background it looks disabled which can be very confusing. By the way, the vast majority of buttons on the network is set as primary (filled in green) anyway.
  • This is part of the reason why I decided to remove the ghost buttons as well. They are very rarely used and I think the new design of the default button is a good replacement – especially since ghost buttons are only ever used in combination with primary or danger buttons.
  • I introduced new color shades (primary-light and primary-dark, same for danger), so the hover and active states are now more easily distinguishable.
  • Buttons can now explicitly be set as circle shapes which was impossible before.

Issues

Questions

  • Testing: We should make this decision as a team, but I'm especially interested what @mattwr18 has to say – because you added tests for CounterIcon: What should be covered in component tests, especially for generic components?
    I think it would make sense to test logic, but only if there is any (in case of the CounterIcon I added a cap for the counter, so we could make sure that count values below 100 are displayed at their actual value and counts above as 99+) but I don't think it is necessary to test that all the elements are rendered. If that is something we do want to test I would maybe suggest the storybook snapshots instead. What do you think?

  • Icon Button Design: Do you think there is a use case for the below button style or should icon-only buttons by default be circles?

Screenshot 2019-12-18 at 12 39 09

ToDo

  • get the design approved 😁
  • replace <ds-button> with <base-button> throughout the project
  • use scss variables in BaseComponents

@alina-beck alina-beck self-assigned this Dec 18, 2019
@alina-beck alina-beck requested review from DennisHack and a team December 18, 2019 07:25
@cypress
Copy link

cypress bot commented Dec 18, 2019



Test summary

51 0 0 0


Run details

Project Human-Connection
Status Passed
Commit 42e2e39
Started Jan 15, 2020 11:00 AM
Ended Jan 15, 2020 11:12 AM
Duration 11:42 💡
OS Linux Ubuntu Linux - 16.04
Browser Chromium 79

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@alina-beck alina-beck changed the title [WIP] Migrate Styleguide Buttons Migrate Styleguide Buttons Dec 19, 2019
@Tirokk Tirokk changed the title Migrate Styleguide Buttons 🍰 Migrate Styleguide Buttons Dec 19, 2019
Tirokk
Tirokk previously requested changes Dec 19, 2019
Copy link
Member

@Tirokk Tirokk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow @alina-beck !
That looks really nice and is great in general !!! 😍💫👍🏼

Examples …

  • The buttons in the editor looking great!
  • … for the categories as well!

I just started the review and will add up what I’ve seen so far:

On the frontend I found:

  • On the new terms and conditions page hover the button looks not nice. The text is unreadable:

Bildschirmfoto 2019-12-19 um 09 22 09

  • On the create post page Cancel looks on hover the same as Save not hovered:

Bildschirmfoto 2019-12-19 um 09 31 51

  • If I hover an emoticon on the post page nothing changes at all before I click:

Bildschirmfoto 2019-12-19 um 09 34 27

  • The content menu is not working on a post card:

Bildschirmfoto 2019-12-19 um 09 28 19

  • Create post button is not working on the users profile page:

Bildschirmfoto 2019-12-19 um 09 26 12

  • Shall the notifications red number circle be cut?

Bildschirmfoto 2019-12-19 um 10 42 38

  • Emoticons are a little bit small in the filter menu and not aligned with the Users I follow button:

Bildschirmfoto 2019-12-19 um 11 01 04

… review in progress …

@@ -74,7 +74,7 @@ describe('CommentForm.vue', () => {

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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 😍

<base-button
:disabled="disabled && !update"
@click="handleCancel"
data-test="cancel-button"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same same 👆🏼

@alina-beck
Copy link
Collaborator Author

Wow @Tirokk, thank you! That was a very thorough review. 😍
I'll go fix it now. 😉

@alina-beck alina-beck requested review from Tirokk and a team January 14, 2020 13:54
@alina-beck
Copy link
Collaborator Author

I addressed all changes that @Tirokk suggested and added a few more improvements – with one exception: the emotions buttons, both on the post page and the filter menu, are fixed in a follow-up PR (see #2582) because the markup was quite messed up and needed some bigger changes. 😉

@alina-beck alina-beck changed the title 🍰 Migrate Styleguide Buttons refactor(styleguide): migrate and redesign buttons Jan 14, 2020
@alina-beck alina-beck dismissed Tirokk’s stale review January 14, 2020 14:14

all changes addressed

Copy link
Member

@mattwr18 mattwr18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like I asked for some changes, but I'm going to approve, cause maybe you can give reasons why, or you have changed them in the other PR
Great job!! Really love it! would love to get the client, @DennisHack, to sign off on the design changes, if he hasn't already

</ds-button>
</ds-flex-item>
</ds-flex>
<div class="buttons">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would typically suggest something a bit more descriptive, but I really like how you target this class as a grandchild of comment-form to apply CSS, so it doesn't make me nervous that the styling will be accidentally applied elsewhere.
Or that we be tempted to use scoped

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, it's counter-intuitive at first! Also my first time to use it like this but if we really follow the rscss suggestions and VueJS Styleguide all our components will have two-word-names and we'd only have these shorter and more generic class names as children of more specific classes. And I really like the readability of buttons in comment-form as opposed to BEM-style comment-form__buttons... 😉

margin-top: 0;

> .counter-icon {
margin-right: 12px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we wanted to avoid using magic numbers instead of design tokens, @alina-beck ??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got me... 😊 we do!

filled
:disabled="!deleteEnabled"
@click="handleSubmit"
>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this still ds-button?
actually, there are 10 files for me locally that still include ds-button... I will have a look at the other PR you put in... maybe there were bigger changes needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's in the second PR. I know it's a bit confusing, I'll try to find a better solution next time than splitting things up into two PRs... sorry! 🤷‍♀

<ds-button
<div class="follow-filter-button">
<base-button
name="filter-by-followed-authors-only"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you didn't add this, but is this here only for testing purposes?
if so, wouldn't it be better to use data-test, which is removed in production?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, I'll go check!

import NotificationMenu from './NotificationMenu'

const localVue = global.localVue

localVue.filter('truncate', string => string)

config.stubs.dropdown = '<span class="dropdown"><slot /></span>'
config.stubs.dropdown = '<span class="dropdown"><slot :toggleMenu="() => null" /></span>'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool trick!

it('uses a primary button', () => {
expect(tag.classes()).toContain('ds-tag-primary')
it('renders the capped count with a plus', () => {
expect(count.text()).toEqual('99+')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really like this!

Report Details
</ds-button>
</counter-icon>
<counter-icon icon="bell" :count="0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool stuff here!
I like that I can see what they look like without needing to create 100 notifications, for example
I did notice that the counter is neutral when inactive... which makes sense!

.add('default', () => ({
components: { LoadingSpinner },
template: '<loading-spinner />',
}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it just spins and spins!! 😛

transform: rotate(2160deg);
}
}
</style>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool new reusable component!

<ds-button @click="back" :disabled="!hasPrevious" icon="arrow-left" primary />
</ds-flex-item>
</ds-flex>
<hc-paginate :hasNext="hasNext" :hasPrevious="hasPrevious" @next="next" @back="back" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh, thanks... I must have forgotten to refactor this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants