Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Use new button styles #541

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Use new button styles #541

wants to merge 7 commits into from

Conversation

antonok-edm
Copy link
Collaborator

@antonok-edm antonok-edm commented Sep 18, 2019

Changes

Fixes #536.

Addresses concerns from #486 as well.

With this PR, buttons are all themed using a common Button component, and have a visual update as described in #536.

This will require changes in https://github.com/brave/brave-core wherever buttons are used as well.

Test plan

Storybook stories and snapshots have been updated to use the new buttons. I've done a scan through all of the usages of buttons to verify that everything looks acceptable, but another pair of eyes would be appreciated.

Link / storybook path to visual changes

Integration

  • Does this contain changes to src/components or src/

    • Will you publish to npm immediately after this PR, or wait until sometime in the future?
    • Incompatible API change to something existing (major version increase)
    • Adding new backwards-compatible functionality? (minor version increase)
    • Fixing a bug backwards-compatibly? (patch version increase)
  • Does this contain changes to src/features for brave-core?

    • Are there non backwards-compatible changes required for brave-core? Do not merge until brave-core PR is approvable. Link to brave-core PR:
    • Will you create brave-core PR to update to this commit after it is merged?
    • Wants uplift to brave-core feature branch?
      • When uplift-approved, merge to brave-core-0.VV.x feature branch
      • Create additional brave-core PRs for each feature branch to update commit

onClick?: () => void
id?: string
disabled?: boolean
icon?: {image: React.ReactNode, position: 'before' | 'after'}
className?: string
}

export type Level = 'primary' | 'secondary' | 'tertiary'
export type Type = 'default' | 'accent' | 'warn' | 'subtle'
export type Level = 'default' | 'primary' | 'secondary' | 'tertiary'
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure it's clear to me that we should have a default value here - it's not understandable how this semantically fits in between the hierarchy of primary / secondary / tertiary

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 just took that directly from abstract, cc @karenkliu

Copy link
Member

Choose a reason for hiding this comment

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

@karenkliu @antonok-edm we should probably sync-up as it seems that whilst this has removed some variations, it seems more complicated to use. Right now we have properties that easily allow a developer or designer to know when to use which button:

  • 'level' which indicates the importance of the button (most important in the UI vs one of many equal actions) and affects the style of the button,

image

  • 'type' which indicates the type of action (positive, negative, primary brand action) and just really affects the color

image

These two properties are independent and could allow for all combinations.

In this new version we have a single property called 'Levels' in which I would expect the values to be hierarchical and has 4 variations - primary, secondary, tertiary and default. I wouldn't know when to use 'default' vs the hierarchical values. I would expect most buttons which aren't Primary actions to be Secondary actions, but now I'm guessing they should be Default actions and it's unclear when to use Secondary vs Tertiary.

image

IMO we shouldn't mix metaphors here - either keep the semantic definitions (and ideally backwards-compatible) or choose new ones.

As another aside, these new button styles are slightly different to the other new button styles that Ross implemented in brave-core's WebUI at brave/brave-core#2778. Those ones have a slight hover effect on 'pressed' and also a nicer focus outline style (that last one we should definitely adopt).

@petemill
Copy link
Member

Please add a storybook link via running now -p on your local branch.

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

Successfully merging this pull request may close these issues.

Restyle buttons according to updated mockups
2 participants