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

fix(pseudo-checkbox): alignment issue and border color #3144

Merged
merged 2 commits into from
Feb 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions src/demo-app/checkbox/checkbox-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,15 @@ <h1>md-checkbox: Basic Example</h1>
</div>
</div>

<h1>Pseudo checkboxes</h1>
<md-pseudo-checkbox></md-pseudo-checkbox>
<md-pseudo-checkbox [disabled]="true"></md-pseudo-checkbox>

<md-pseudo-checkbox state="checked"></md-pseudo-checkbox>
<md-pseudo-checkbox state="checked" [disabled]="true"></md-pseudo-checkbox>

<md-pseudo-checkbox state="indeterminate"></md-pseudo-checkbox>
<md-pseudo-checkbox state="indeterminate" [disabled]="true"></md-pseudo-checkbox>

<h1>Nested Checklist</h1>
<md-checkbox-demo-nested-checklist></md-checkbox-demo-nested-checklist>
10 changes: 8 additions & 2 deletions src/demo-app/demo-app-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import {HttpModule} from '@angular/http';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {DemoApp, Home} from './demo-app/demo-app';
import {RouterModule} from '@angular/router';
import {MaterialModule, OverlayContainer, FullscreenOverlayContainer} from '@angular/material';
import {
MaterialModule,
OverlayContainer,
FullscreenOverlayContainer,
MdSelectionModule,
} from '@angular/material';
import {DEMO_APP_ROUTES} from './demo-app/routes';
import {ProgressBarDemo} from './progress-bar/progress-bar-demo';
import {JazzDialog, ContentElementDialog, DialogDemo, IFrameDialog} from './dialog/dialog-demo';
Expand Down Expand Up @@ -47,6 +52,7 @@ import {StyleDemo} from './style/style-demo';
ReactiveFormsModule,
RouterModule.forRoot(DEMO_APP_ROUTES),
MaterialModule.forRoot(),
MdSelectionModule,
],
declarations: [
AutocompleteDemo,
Expand Down Expand Up @@ -93,7 +99,7 @@ import {StyleDemo} from './style/style-demo';
SunnyTabContent,
RainyTabContent,
FoggyTabContent,
PlatformDemo
PlatformDemo,
],
providers: [
{provide: OverlayContainer, useClass: FullscreenOverlayContainer}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
$warn: map-get($theme, warn);
$background: map-get($theme, background);

// The color of the checkbox's checkmark / mixedmark.
$checkbox-mark-color: mat-color($background, background);

// NOTE(traviskaufman): While the spec calls for translucent blacks/whites for disabled colors,
// this does not work well with elements layered on top of one another. To get around this we
// blend the colors together based on the base color and the theme background.
$white-30pct-opacity-on-dark: #686868;
$black-26pct-opacity-on-light: #b0b0b0;
$disabled-color: if($is-dark-theme, $white-30pct-opacity-on-dark, $black-26pct-opacity-on-light);

.mat-pseudo-checkbox::after {
color: $checkbox-mark-color;
.mat-pseudo-checkbox {
color: if($is-dark-theme, rgba(white, 0.7), rgba(black, 0.54));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use 'secondary-text' from the $foreground palette instead? You won't have to check the theme.


&::after {
color: mat-color($background, background);
}
}

.mat-pseudo-checkbox-checked, .mat-pseudo-checkbox-indeterminate {
Expand Down
4 changes: 4 additions & 0 deletions src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ $_mat-pseudo-checkmark-size: $mat-checkbox-size - (2 * $_mat-pseudo-checkbox-pad
border-bottom: $mat-checkbox-border-width solid currentColor;
transition: opacity $mat-checkbox-transition-duration $mat-linear-out-slow-in-timing-function;
}

&.mat-pseudo-checkbox-checked, &.mat-pseudo-checkbox-indeterminate {
border: none;
}
}

.mat-pseudo-checkbox-disabled {
Expand Down