Skip to content

Commit

Permalink
fix(kit): MarkerIcon only show hover state for interactive elements (
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Oct 24, 2022
1 parent e17346d commit 90da7d5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe(`tuiMarkerIcon`, () => {
it(`link`, () => {
cy.tuiVisit(`/components/marker-icon#modes`);

cy.get(`tui-doc-example[heading="modes"]`)
.findByAutomationId(`tui-doc-example`)
.tuiScrollIntoView()
.as(`content`);

cy.get(`@content`).should(`be.visible`).matchImageSnapshot();

cy.get(`@content`)
.find(`a[tuiMarkerIcon]`)
.trigger(`mouseover`)
.trigger(`mouseenter`)
.invoke(`show`)
.click() // emulate hover
.matchImageSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
src="tuiIconBellLarge"
class="tui-space_right-2"
></tui-marker-icon>
<tui-marker-icon
<a
tuiMarkerIcon
mode="link"
src="tuiIconBellLarge"
class="tui-space_right-2"
></tui-marker-icon>
></a>
<tui-marker-icon
mode="success"
src="tuiIconBellLarge"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {TuiMarkerIconMode} from '@taiga-ui/kit/types';
import {Observable} from 'rxjs';

@Component({
selector: `tui-marker-icon`,
selector: `tui-marker-icon, a[tuiMarkerIcon], button[tuiMarkerIcon]`,
templateUrl: `./marker-icon.template.html`,
styleUrls: [`./marker-icon.style.less`],
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
20 changes: 12 additions & 8 deletions projects/kit/components/marker-icon/marker-icon.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,22 @@

&[data-marker-mode='link'] {
.transition(color);
cursor: pointer;
color: var(--tui-link);
background-color: var(--tui-secondary);

&:hover {
color: var(--tui-link-hover);
background-color: var(--tui-secondary-hover);
}
a&,
button& {
cursor: pointer;

&:hover {
color: var(--tui-link-hover);
background-color: var(--tui-secondary-hover);
}

&:active {
color: var(--tui-link-hover);
background-color: var(--tui-secondary-active);
&:active {
color: var(--tui-link-hover);
background-color: var(--tui-secondary-active);
}
}
}
}
Expand Down

0 comments on commit 90da7d5

Please sign in to comment.