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

Add marketing buttons to primer-marketing-buttons #337

Merged
merged 24 commits into from
Nov 7, 2017
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
41f157b
add marketing buttons to primer-marketing-buttons
gladwearefriends Sep 6, 2017
a6db97c
add import to primer-marketing
gladwearefriends Sep 6, 2017
2e039ad
update read me for buttons
gladwearefriends Sep 6, 2017
bfeb14a
actually update the marketing buttons readme for reals
gladwearefriends Sep 6, 2017
ece1533
update package.json
gladwearefriends Sep 6, 2017
d16903a
use variables and move .btn-large into primer-marketing-buttons
gladwearefriends Sep 6, 2017
234e3b2
edit dependencies, does not need primer-marketing-support
gladwearefriends Sep 6, 2017
ca26cfc
edit package.json
gladwearefriends Sep 13, 2017
1078145
update readme to pass test
gladwearefriends Sep 13, 2017
da1c1c4
Updating scripts
jonrohan Oct 27, 2017
0383073
Updating changelog
jonrohan Oct 27, 2017
a1918c9
Using variable for fade
jonrohan Oct 27, 2017
69685d9
Updating version
jonrohan Oct 27, 2017
f1681f3
add primer-marketing-buttons to primer-marketing package.json
gladwearefriends Nov 2, 2017
22c7f75
add stories.js for storybook
gladwearefriends Nov 3, 2017
fc30322
rm changelog update
gladwearefriends Nov 7, 2017
1c81f3c
rm btn-blurple
gladwearefriends Nov 7, 2017
cea6e67
use border variables
gladwearefriends Nov 7, 2017
60a8d27
move btn-large back into primer-buttons, update docs
gladwearefriends Nov 7, 2017
171e0b6
move btn-large test into primer-buttons’ stories.js
gladwearefriends Nov 7, 2017
43e12e8
only btn-orange is being added
gladwearefriends Nov 7, 2017
7f9fc05
test wants an example of counter
gladwearefriends Nov 7, 2017
73b5205
Setting up peer dependency for marketing buttons, fixing generator de…
jonrohan Nov 7, 2017
6c4d49d
revert changelog
jonrohan Nov 7, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
- Importing `.input-group` into `primer-forms` module.
- New module `primer-branch-name` "A nice, consistent way to display branch names."
- New module `primer-dropdown` "A lightweight context menu for navigation and actions."
- New module `primer-marketing-buttons`. Buttons for marketing websites at GitHub
Copy link
Member

Choose a reason for hiding this comment

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

We're going to get mad merge conflicts in the v10 branch if everyone updates the changelog (hadn't thought of this before), can you remove the changes here and just add a comment to your pr with "To be included in the Changelog" so we can copy the updates over.


### Removed
- Removing `primer-cards` module.
- Removing `.form-cards` styles.
- Removing `.btn-large` from `primer-buttons` module and adding to `primer-marketing-buttons`.

### Changes
- Moving `primer-breadcrumb` from `primer-marketing` to `primer-core`
Expand Down
7 changes: 0 additions & 7 deletions modules/primer-buttons/lib/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@
line-height: 20px;
}

// Large button adds more padding around text. Use font-size utils to increase font-size.. e.g, <p class="text-gamma"><button class="btn btn-large btn-primary" type="button">Big green button</button></p>
.btn-large {
Copy link
Member

Choose a reason for hiding this comment

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

This is used in some locations outside of /site/ directory - are you sure this is not needed for product? I think there are some instances of people using utilities to make buttons larger too. One location I can think of is the dashboard banner when you are a new user - easiest way to see this is to run the dev environment locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

im moving btn-large back into primer core here! not sure why i moved it into marketing-buttons other than i thought it was only used on marketing pages 🤷🏻‍♀️

padding: 0.75em 1.25em;
font-size: inherit;
border-radius: 6px;
}

// Hidden text button
//
// Use `.hidden-text-expander` to indicate and expand hidden text.
Expand Down
1 change: 1 addition & 0 deletions modules/primer-css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"primer-labels": "1.5.1",
"primer-layout": "1.4.1",
"primer-markdown": "3.7.1",
"primer-marketing-buttons": "0.0.1",
Copy link
Member

Choose a reason for hiding this comment

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

testing

Copy link
Member

Choose a reason for hiding this comment

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

testing testing

Copy link
Member

Choose a reason for hiding this comment

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

Note to change this to 1.0.0 after merging into v10 branch and run bump script. cc @jonrohan

"primer-marketing-support": "1.3.1",
"primer-marketing-type": "1.4.1",
"primer-marketing-utilities": "1.4.1",
Expand Down
2 changes: 2 additions & 0 deletions modules/primer-marketing-buttons/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.yml
.github
21 changes: 21 additions & 0 deletions modules/primer-marketing-buttons/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
105 changes: 105 additions & 0 deletions modules/primer-marketing-buttons/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Primer Marketing CSS Buttons

[![npm version](http://img.shields.io/npm/v/primer-marketing-buttons.svg)](https://www.npmjs.org/package/primer-marketing-buttons)
[![Build Status](https://travis-ci.org/primer/primer-css.svg?branch=master)](https://travis-ci.org/primer/primer-css)

> Buttons are used for actions, like in forms, while textual hyperlinks are used for destinations, or moving from one page to another.

This repository is a module of the full [primer-css][primer] repository.

## Documentation

<!-- %docs
title: Marketing Buttons
status: New Release
-->

The buttons on our marketing pages are based on Primer's core with the addition of more color options, color outline buttons, a transparent button, and larger button sizes.
Copy link
Member

Choose a reason for hiding this comment

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

This could be more concise and it's good to link to docs within the style guide. Suggest changing to:

Marking buttons extend primer-core buttons with more color and fill styles, and a large button option.



## Color

The `btn` has been extended with the marketing color palette:
Copy link
Member

Choose a reason for hiding this comment

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

Suggest changing to more descriptive sentence:

Marketing buttons are available in orange, purple, and blurple indego.

😬


```html

<button class="btn btn-orange" type="button">Button button</button>
<a class="btn btn-purple" href="#url" role="button">Link button</a>
<button class="btn btn-blurple" type="button">Button button</button>

```

## Outline buttons

The `btn-outline` has also been extended with the marketing color palette:

```html

<button class="btn btn-outline-orange" type="button">Button button</button>
<a class="btn btn-outline-purple" href="#url" role="button">Link button</a>
<button class="btn btn-outline-green" type="button">Button button</button>
<div class="bg-gray-dark p-4 mt-4">
<button class="btn btn-transparent" type="button">
Copy link
Member

Choose a reason for hiding this comment

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

btn-transparent shouldn't be grouped with the outline options, it should have is own description and be a separate example.

Button button
<span class="Counter">12</span>
</button>
</div>

```

## Additional sizing
There are cases where you might want to increase the size of a button, for example when putting a main CTA inside of a jumbotron or major page callout. The `btn-large` class does the following to make a button more prominent:
Copy link
Member

Choose a reason for hiding this comment

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

I think the intro paragraph can be more concise, and I don't think we need to call out the description in a numbered list or get into exact values, suggest changing to something like the following:

Use btn-large to increase the padding and border radius of a button. This is useful for prominent calls to action, and is often used in combination with jumbtron styles.

Type scale utilities can be used to alter the font-size if needed. Padding is applied in em's so that it scales proportionally with the font-size.

Side note: As someone less familiar with marketing styles, I had no idea what a jumbotron might be. I looked it up and this looks like it could be called hero which I think is more meaningful to people. We try to stick with class names that are obvious, transparent, and human-readable—could we change this to something more meaningful in future? Related, minitron and supertron could just me small and large 🤷‍♀️. I get this is probably just a bit of humor, but it's un-helpful for people learning to use Primer. cc @sophshep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed the language in this section of the docs to "This is useful for prominent calls to action in hero sections."

Related, this section of the docs pertaining to btn-large is also moved into primer-buttons' readme.md as btn-largehas been moved back to primer-buttons as well, where it originally was just without documentation.


1. Adds extra additional padding in `ems` so that the padding scales proportionately with the `font-size`
2. Increases the border radius to 6px

It can optionally be used in combination with a font-size utility (like `f3`) on the parent to increase the font-size.

```html

<p class="f3">
Copy link
Member

Choose a reason for hiding this comment

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

Show how the default btn-large looks without a font size change, then show another example with a type scale utility.

<a class="btn btn-large btn-purple" href="#url" role="button">Large link button</a>
<button class="btn btn-large btn-outline-blue" type="button">Large button button</button>
</p>

```

<!-- %enddocs -->

## Install

This repository is distributed with [npm][npm]. After [installing npm][install-npm], you can install `primer-marketing-buttons` with this command.

```
$ npm install --save primer-marketing-buttons
```

## Usage

The source files included are written in [Sass][sass] (`scss`) You can simply point your sass `include-path` at your `node_modules` directory and import it like this.

```scss
@import "primer-marketing-buttons/index.scss";
```

You can also import specific portions of the module by importing those partials from the `/lib/` folder. _Make sure you import any requirements along with the modules._

## Build

For a compiled **css** version of this module, a npm script is included that will output a css version to `build/build.css`

```
$ npm run build
```

## License

MIT &copy; [GitHub](https://github.com/)

[primer]: https://github.com/primer/primer
[primer-support]: https://github.com/primer/primer-support
[support]: https://github.com/primer/primer-support
[docs]: http://primercss.io/
[npm]: https://www.npmjs.com/
[install-npm]: https://docs.npmjs.com/getting-started/installing-node
[sass]: http://sass-lang.com/
3 changes: 3 additions & 0 deletions modules/primer-marketing-buttons/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// support files
@import "primer-support/index.scss";
@import "./lib/button.scss";
32 changes: 32 additions & 0 deletions modules/primer-marketing-buttons/lib/button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.btn-orange { @include btn-solid($white, lighten($orange-500, 7.5%), darken($orange-500, 7.5%)); }
.btn-blurple { @include btn-solid($white, mix($blue-400, $purple-400, 35%), mix($blue-600, $purple-600, 35%)); }
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to give this a legit class name (such as indigo), and I'd like to discuss why we have this exception regarding colors. I think we should very rarely use a color in our UI for a single use case that is not used in any other way on our site. Do we really need this extra color? Could it be a shade variation of existing colors, or use another existing button color, such as btn-blue? Or, do we need to add indigo to our color system so that it may be used in more places than just this one button? cc @sophshep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are good questions @broccolini. It looks like theyre only used on the business pages here: https://github.com/business and on app/views/coupons/business_plus_only/show.html.erb (not sure where that view is). I'm for keeping this as a one off style in github/github. im not sure if its used anywhere else on other one off marketing pages outside of github/github and it does seem weird to go out of the primer color system. What do you think @sophshep ?

At this point im gonna leave it out of this PR. I can put it back in if we think we should do it.


.btn-outline-purple { @include btn-outline($purple); }
.btn-outline-orange { @include btn-outline($orange); }
.btn-outline-green { @include btn-outline($green); }

@mixin btn-transparent-active {
color: $gray-800;
background-color: $white;
background-image: none;
border-color: $white;
}

.btn-transparent {
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem to be used anywhere in the github/github is it being used elsewhere for marketing sites?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is sometimes used on the ads we have on the homepage below the hero on github.com. I personally have also used it here on the hero and circular callouts https://partner.github.com/

color: $white;
background-color: transparent;
background-image: none;
border: 1px solid $white-fade-50;
Copy link
Member

Choose a reason for hiding this comment

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

Use border variables: $border-width $border-style here.


&:hover,
&:active {
@include btn-transparent-active;
}
}

// Large button adds more padding around text. Use font-size utils to increase font-size.. e.g, <p class="text-gamma"><button class="btn btn-large btn-primary" type="button">Big green button</button></p>
.btn-large {
padding: 0.75em 1.25em;
font-size: inherit;
border-radius: 6px;
}
41 changes: 41 additions & 0 deletions modules/primer-marketing-buttons/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "0.0.1",
"name": "primer-marketing-buttons",
"description": "Buttons for marketing websites at GitHub",
"homepage": "http://primercss.io/",
"author": "GitHub, Inc.",
"license": "MIT",
"style": "build/build.css",
"main": "build/index.js",
"primer": {
"category": "marketing",
"module_type": "components"
},
"files": [
"index.scss",
"lib",
"build"
],
"repository": "https://github.com/primer/primer-css/tree/master/modules/primer-marketing-buttons",
"bugs": {
"url": "https://github.com/primer/primer-css/issues"
},
"scripts": {
"test-docs": "../../script/test-docs",
"build": "../../script/npm-run primer-module-build index.scss",
"prepare": "npm run build",
"lint": "../../script/lint-scss",
"test": "../../script/npm-run-all build lint test-docs"
},
"dependencies": {
"primer-support": "4.4.1"
Copy link
Member

Choose a reason for hiding this comment

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

These buttons are designed to be used with btn so they can't be used without installing primer-buttons. It's not a code dependency, but perhaps should be a peer dependency? What do you think @jonrohan?

Copy link
Member

Choose a reason for hiding this comment

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

I think peerDependency makes sense here. Be sure when you manually add it, that it's the current version of primer-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 just had a flash back to trying to setup peer dependencies with Lerna from the original monorepo set up and it wasn't pretty. @gladwearefriends leave that to us, maybe it's all fine now since there's been lots of changes but I'd rather us deal with problems if they come up than you! We can do this before merging in tomorrow.

},
"keywords": [
"css",
"github",
"primer",
"primercss",
"style",
"buttons"
]
}
27 changes: 27 additions & 0 deletions modules/primer-marketing-buttons/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import { storiesOf } from '@storybook/react'

storiesOf('Marketing buttons', module)
.add('Button colors', () => (
<div className='p-4'>
<button className="btn btn-orange mr-6" type="button">Button button</button>
<a className="btn btn-purple mr-6" href="#url" role="button">Link button</a>
<button className="btn btn-blurple mr-6" type="button">Button button</button>
</div>
))
.add('btn-outline', () => (
<div className='p-4'>
<button className="btn btn-outline-orange mr-6" type="button">Button button</button>
<a className="btn btn-outline-purple mr-6" href="#url" role="button">Link button</a>
<button className="btn btn-outline-green mr-6" type="button">Button button</button>
<div className="bg-gray-dark p-4 mt-4 mr-6">
<button className="btn btn-transparent mr-6" type="button">Button button</button>
</div>
</div>
))
.add('btn-large', () => (
<div className='f3 p-4'>
<a className="btn btn-large btn-purple mr-6" href="#url" role="button">Large link button</a>
<button className="btn btn-large btn-outline-blue" type="button">Large button button</button>
</div>
))
1 change: 1 addition & 0 deletions modules/primer-marketing/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

// marketing specific css modules
@import "primer-marketing-type/index.scss";
@import "primer-marketing-buttons/index.scss";
Copy link
Contributor

Choose a reason for hiding this comment

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

In order for this to work, we'll also need to add this to the dependencies list in modules/primer-marketing/package.json. You should use the same version as you provide in this module's package.json.

@import "primer-page-headers/index.scss";
@import "primer-page-sections/index.scss";
@import "primer-tables/index.scss";
Expand Down
1 change: 1 addition & 0 deletions modules/primer-marketing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"lint": "../../script/lint-scss"
},
"dependencies": {
"primer-marketing-buttons": "0.0.1",
"primer-marketing-support": "1.3.1",
"primer-marketing-type": "1.4.1",
"primer-marketing-utilities": "1.4.1",
Expand Down