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

feat(button): Implement stroked button #1194

Merged
merged 4 commits into from
Aug 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 48 additions & 0 deletions demos/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,30 @@ <h1 class="mdc-typography--display2">Ripple Enabled</h1>
</div>
</fieldset>

<fieldset>
<legend class="mdc-typography--title">Stroked Button</legend>
<div>
<button class="mdc-button mdc-button--stroked">
Baseline
</button>
<button class="mdc-button mdc-button--stroked mdc-button--compact">
Compact
</button>
<button class="mdc-button mdc-button--stroked mdc-button--dense">
Dense
</button>
<button class="mdc-button mdc-button--stroked mdc-button--primary">
Primary
</button>
<button class="mdc-button mdc-button--stroked mdc-button--accent">
Secondary
</button>
<a href="javascript:void(0)" class="mdc-button mdc-button--stroked">
Link
</a>
</div>
</fieldset>

<h1 class="mdc-typography--display2">CSS Only</h1>
<fieldset>
<legend class="mdc-typography--title">Text Button</legend>
Expand Down Expand Up @@ -273,6 +297,30 @@ <h1 class="mdc-typography--display2">CSS Only</h1>
</a>
</div>
</fieldset>

<fieldset>
<legend class="mdc-typography--title">Stroked Button</legend>
<div>
<button class="mdc-button mdc-button--stroked" data-demo-no-js>
Baseline
</button>
<button class="mdc-button mdc-button--stroked mdc-button--compact" data-demo-no-js>
Compact
</button>
<button class="mdc-button mdc-button--stroked mdc-button--dense" data-demo-no-js>
Dense
</button>
<button class="mdc-button mdc-button--stroked mdc-button--primary" data-demo-no-js>
Primary
</button>
<button class="mdc-button mdc-button--stroked mdc-button--accent" data-demo-no-js>
Secondary
</button>
<a href="javascript:void(0)" class="mdc-button mdc-button--stroked" data-demo-no-js>
Link
</a>
</div>
</fieldset>
</section>
</main>

Expand Down
9 changes: 9 additions & 0 deletions packages/mdc-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ semantically correct.
</button>
```

#### Stroked Button

```html
<button class="mdc-button mdc-button--stroked">
Stroked button
</button>
```

### Button state

#### Disabled
Expand Down Expand Up @@ -138,6 +146,7 @@ The provided modifiers are:
| --------------------- | ------------------------------------------------------- |
| `mdc-button--raised` | A contained button that is elevated upon the surface. |
| `mdc-button--unelevated` | A contained button that is flush with the surface. |
| `mdc-button--stroked` | A contained button that is flush with the surface and has a visible border. |
| `mdc-button--dense` | Compresses the button text to make it slightly smaller. |
| `mdc-button--compact` | Reduces the amount of horizontal padding in the button. |
| `mdc-button--primary` | Colors the button with the primary color. |
Expand Down
36 changes: 36 additions & 0 deletions packages/mdc-button/mdc-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,23 @@
}
}

.mdc-button--stroked {
@include mdc-theme-prop(border-color, text-primary-on-light);

border-width: 2px;
border-style: solid;
line-height: 32px;

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(border-color, text-primary-on-dark);
}

// postcss-bem-linter: ignore
&.mdc-button--dense {
line-height: 27px; // To accommodate odd font size of dense button
}
}

.mdc-button--compact {
padding: 0 8px;
}
Expand Down Expand Up @@ -134,6 +151,14 @@
@include mdc-theme-prop(background-color, $theme-style);
@include mdc-theme-prop(color, text-primary-on-#{$theme-style});
}
// postcss-bem-linter: ignore
&.mdc-button--stroked {
@include mdc-theme-prop(border-color, $theme-style);

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(border-color, $theme-style);
}
}
}
}

Expand Down Expand Up @@ -168,4 +193,15 @@
}
}
}

.mdc-button--stroked {
fieldset:disabled &,
&:disabled {
border-color: rgba(black, .38);

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(border-color, text-disabled-on-dark);
}
}
}
// postcss-bem-linter: end