-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelpers.less
109 lines (97 loc) · 2.23 KB
/
helpers.less
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* Debug an element with an outline with custom size and color.
*/
.debug (@size: 1px, @color: red) {
outline: @size solid @color;
}
/**
* Set bigger hitzone with :after.
*/
.hitZone (@horizontalSize: 10px, @verticalSize: 10px, @color: transparent) {
&:after {
content: "";
background-color: @color;
position: absolute;
top: -@verticalSize;
right: -@horizontalSize;
bottom: -@verticalSize;
left: -@horizontalSize;
}
}
/**
* Hide text only visually to preserve seo check
* https://webaim.org/techniques/css/invisiblecontent/#techniques
* https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
*/
.visuallyHidden() {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
width: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
}
// ----------------------------------------------------------------------------- POSITION AND SIZE
/**
* Center with absolute and translate yx, y or x.
* Use with caution, preferable to avoid and use flex most of time.
*/
.absoluteCenter (@axis:yx) {
& when (@axis = yx) {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
& when (@axis = y) {
position: absolute;
top: 50%;
left: auto;
transform: translateY(-50%);
}
& when (@axis = x) {
position: absolute;
top: auto;
left: 50%;
transform: translateX(-50%);
}
}
/**
* Remove touch callout on safari mobile
*/
.disableTouchCallout () {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}
// ----------------------------------------------------------------------------- SCROLLS
/**
* Patch scrolling on iOS
*/
.hideScrollBar () {
overflow-scrolling: touch;
&::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
}
}
/**
* Force scrollBar to be shown
*/
.showScrollBar () {
-ms-overflow-style: scrollbar;
&::-webkit-scrollbar {
width: auto;
height: auto;
}
}
// ----------------------------------------------------------------------------- FONTS
/**
* Smooth fonts
*/
.fontSmooth () {
font-smooth: always;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}