Skip to content

link disabled style changed to attribute #44

Merged
merged 2 commits into from
Sep 4, 2018
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
24 changes: 12 additions & 12 deletions src/lib-dev/link/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,62 @@
<td>Normal</td>
</tr>
<tr>
<td><a class="mc-link mc-disabled" tabindex="-1" href=""><span class="mc-link__text">Сохранить</span></a></td>
<td><a class="mc-link" tabindex="0"><span class="mc-link__text">Сохранить</span></a></td>
<td><a class="mc-link" [disabled]="true" href=""><span class="mc-link__text">Сохранить</span></a></td>
<td><a class="mc-link"><span class="mc-link__text">Сохранить</span></a></td>
</tr>
<tr>
<td><a class="mc-link mc-link_dashed mc-disabled" tabindex="-1" href=""><span class="mc-link__text">Сохранить</span></a></td>
<td><a class="mc-link mc-link_dashed" tabindex="0"><span class="mc-link__text">Сохранить</span></a></td>
<td><a class="mc-link mc-link_dashed" [disabled]="true" href=""><span class="mc-link__text">Сохранить</span></a></td>
<td><a class="mc-link mc-link_dashed"><span class="mc-link__text">Сохранить</span></a></td>
</tr>
<tr>
<td>
<a class="mc-link mc-link_underlined mc-disabled" tabindex="-1" href="">
<a class="mc-link mc-link_underlined" [disabled]="true" href="">
<span class="mc-link__text">Сохранить</span>
</a>
</td>
<td>
<a class="mc-link mc-link_underlined" tabindex="0" href="">
<a class="mc-link mc-link_underlined" href="">
<span class="mc-link__text">Сохранить</span>
</a>
</td>

</tr>
<tr>
<td>
<a class="mc-link mc-disabled" tabindex="-1" href="">
<a class="mc-link" [disabled]="true" href="">
<span class="mc-link__text">Сохранить</span>
<i mc-icon="mc-angle-L_16" class="mc-link__icon"></i>
</a>
</td>
<td>
<a class="mc-link" tabindex="0">
<a class="mc-link">
<span class="mc-link__text">Сохранить</span>
<i mc-icon="mc-angle-L_16" class="mc-link__icon"></i>
</a>
</td>
</tr>
<tr>
<td>
<a class="mc-link mc-link_dashed mc-disabled" tabindex="-1" href="">
<a class="mc-link mc-link_dashed" [disabled]="true" href="">
<span class="mc-link__text ">Сохранить</span>
<i mc-icon="mc-angle-L_16" class="mc-link__icon"></i>
</a>
</td>
<td>
<a class="mc-link mc-link_dashed" tabindex="0">
<a class="mc-link mc-link_dashed">
<span class="mc-link__text">Сохранить</span>
<i mc-icon="mc-angle-L_16" class="mc-link__icon"></i>
</a>
</td>
</tr>
<tr>
<td><a class="mc-link mc-link_dashed mc-disabled" tabindex="-1" href="">
<td><a class="mc-link mc-link_dashed" [disabled]="true" href="">
<i mc-icon="mc-calendar_16" class="mc-link__icon"></i>
<span class="mc-link__text">Сохранить</span>
<i mc-icon="mc-angle-L_16" class="mc-link__icon"></i>
</a>
</td>
<td><a class="mc-link mc-link_dashed" tabindex="0">
<td><a class="mc-link mc-link_dashed" >
<i mc-icon="mc-calendar_16" class="mc-link__icon"></i>
<span class="mc-link__text">Сохранить</span>
<i mc-icon="mc-angle-L_16" class="mc-link__icon"></i>
Expand Down
3 changes: 0 additions & 3 deletions src/lib/link/_link-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
box-shadow: 0 0 0 2px mc-color($link, 500);
}

&.mc-disabled,
&[disabled] {
color: $link-disabled !important;
box-shadow: none;
Expand Down Expand Up @@ -87,7 +86,6 @@
}
}

&.mc-disabled,
&[disabled] {
& > .mc-link__text {
@include _mc-link-dashes_mixin($link-disabled, 100%, 0.32*0.3);
Expand Down Expand Up @@ -119,7 +117,6 @@
}
}

&.mc-disabled,
&[disabled] {
& > .mc-link__text {
@include _mc-link-dashes_mixin($link-disabled, 66%, 0.32*0.3);
Expand Down
13 changes: 11 additions & 2 deletions src/lib/link/link.component.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import { Component, ElementRef, OnDestroy, ViewEncapsulation } from '@angular/core';
import { Component, ElementRef, OnDestroy, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';

import { FocusMonitor } from '@ptsecurity/cdk/a11y';


@Component({
selector: 'a.mc-link',
template: `<ng-content></ng-content>`,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
styleUrls: ['./link.css']
styleUrls: ['./link.css'],
inputs: ['disabled', 'tabindex'],
host: {
'[attr.disabled]': 'disabled || null',
'[attr.tabindex]': 'disabled ? -1 : tabindex ? tabindex : 0'
}
})

export class McLink implements OnDestroy {
disabled: boolean;
tabindex: number;
Copy link
Member

Choose a reason for hiding this comment

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

посмотри в соседних компонентах на реализацию для @inputs (set/get) + markForCheck()


constructor(private elementRef: ElementRef, private _focusMonitor: FocusMonitor) {

this._focusMonitor.monitor(elementRef.nativeElement, true);
Expand Down
1 change: 0 additions & 1 deletion src/lib/link/link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
border-radius: $link-border-radius;
}

&.mc-disabled,
&[disabled] {
pointer-events: none;
cursor: $link-cursor-disabled;
Expand Down