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

Button and ButtonLink ✨ #30

Merged
merged 15 commits into from May 25, 2018
Merged

Conversation

emplums
Copy link

@emplums emplums commented May 21, 2018

This PR adds Button and ButtonLink 🔢 🔗

Button and ButtonLink could just be Button with a prop to render an tag instead of a tag, but because Button can also take a linkStyle prop to be styled like a link, I think the two should stay separate to avoid confusion. They also render different elements so they feel good as separate components.

From a UX/a11y perspective, usage of ButtonLink should probably be discouraged when possible. Navigational items should be links and look like links, action items should be buttons and look like buttons.

Some notes I wrote up while designing the API for primer-buttons: https://docs.google.com/document/d/1YP2IcysUL0hHMOqPuDOaUka1i7vfnKVPYHwsTZgn7Ac/edit

Part of 0.0.1 beta release: #24

src/Button.js Outdated
'btn-primary': type === 'primary',
'btn-danger': type === 'danger',
'btn-outline': type === 'outline',
'btn-block': block,
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 a lot of people like do this with buttons because it feels good to dry up the code, but I think it actually makes a simpler api to keep buttons separate around their theme. It does mean there are more components to know about, but it means there are fewer props to use with a single button component.

Instead of <Button primary block large/> you'd do <ButtonPrimary block large /> etc.

It also means we can be very intentional with which props we make available to which button themes. Later (which we will!) when we want to add new button variations or props (especially for marketing), we can be more deliberate and choose what props are available for each button. For example, we might never want to use an Octicon in a ButtonOutline or ButtonDanger but we do for primary and etc. (just using examples here).

I think there are definitely cases where we want color themes to be props such as for States, but buttons are pretty complex and we're likely to add onto this component.

package.json Outdated
@@ -13,15 +18,12 @@
"author": "GitHub, Inc.",
"contributors": [
"Diana Mounter <diana.mounter@gmail.com>",
"Shawn Allen <shawn.allen@github.com>"
"Shawn Allen <shawn.allen@github.com>",
Copy link
Member

Choose a reason for hiding this comment

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

Lol so I totally copy-pasted this from another project and did not mean to include. Do y'all want to us to list contributors here? If we do, does that mean we update when anyone else contributes too? I'm worried that could get hairy.

If you keep it please can you update my email to my github email please 😬 broccolini@github.com

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 👎 on it, personally I don't want my email in there. Feels like I might get spammed

import React from 'react'
import classnames from 'classnames'

const ButtonSecondary = props => (
Copy link
Author

Choose a reason for hiding this comment

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

I didn't see any secondary button classes in primer-buttons so removing this one, I don't think secondary buttons exist yet 🤷‍♀️

Copy link
Member

Choose a reason for hiding this comment

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

It's exactly the same as Button 😑 which is not really ideal, we can revisit this later as I think people are used to using Secondary for this style.

@broccolini broccolini changed the base branch from master to release-0.0.1-beta May 25, 2018 16:12
Copy link
Member

@broccolini broccolini left a comment

Choose a reason for hiding this comment

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

Conflicts aside 👍

@jonrohan jonrohan merged commit e8e0c8a into release-0.0.1-beta May 25, 2018
Primer Components release tracking 📋 automation moved this from 🙇‍♀️ WIP to 🚢Done May 25, 2018
@jonrohan jonrohan deleted the task/button-component branch May 25, 2018 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants