summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.ui/components/anchors.less
blob: f0fb7b95b326f6c305a8162527caf77de380f385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@import "mediawiki.mixins";
@import "mediawiki.ui/variables";
@import "mediawiki.ui/mixins";

// Helpers
.mixin-mw-ui-anchor-styles( @mainColor ) {
	color: @mainColor;

	// Hover state
	&:hover {
		color: lighten( @mainColor, @colorLightenPercentage );
	}
	// Focus and active states
	&:focus, &:active {
		color: darken( @mainColor, @colorDarkenPercentage );
		outline: none; // outline fix
	}

	// Quiet mode is gray at first
	&.mw-ui-quiet {
		.mixin-mw-ui-anchor-styles-quiet( @mainColor );
	}
}

/*
Anchors

The anchor base type can be applied to A elements when a basic context styling needs to be given to a link, without
having to assign it as a button type. mw-ui-anchor only changes the text color, and should not be used in combination
with other base classes, such as mw-ui-button.

Markup:
<a href="#" class="mw-ui-anchor mw-ui-progressive">Progressive</a>
<a href="#" class="mw-ui-anchor mw-ui-constructive">Constructive</a>
<a href="#" class="mw-ui-anchor mw-ui-destructive">Destructive</a>

.mw-ui-quiet - Quiet until interaction.

Styleguide 6.2.
*/

// Setup compound anchor selectors (such as .mw-ui-anchor.mw-ui-progressive)
.mw-ui-anchor {
	&.mw-ui-progressive {
		.mixin-mw-ui-anchor-styles( @colorProgressive );
	}

	&.mw-ui-constructive {
		.mixin-mw-ui-anchor-styles( @colorConstructive );
	}

	&.mw-ui-destructive {
		.mixin-mw-ui-anchor-styles( @colorDestructive );
	}
}

/*
Quiet anchors

Use quiet anchors when they are less important and alongside other progressive/destructive/progressive
anchors. Use of quiet anchors is not recommended on mobile/tablet due to lack of hover state.

Markup:
<a href="#" class="mw-ui-anchor mw-ui-progressive mw-ui-quiet">Progressive</a>
<a href="#" class="mw-ui-anchor mw-ui-constructive mw-ui-quiet">Constructive</a>
<a href="#" class="mw-ui-anchor mw-ui-destructive mw-ui-quiet">Destructive</a>

Styleguide 6.2.1.
*/
.mixin-mw-ui-anchor-styles-quiet( @mainColor ) {
	color: @colorTextLight;
	text-decoration: none;

	&:hover {
		color: @mainColor;
	}
	&:focus, &:active {
		color: darken( @mainColor, @colorDarkenPercentage );
	}
}