-
Notifications
You must be signed in to change notification settings - Fork 188
/
Copy path_cards.scss
94 lines (81 loc) · 2.12 KB
/
_cards.scss
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
/*
* Backpack - Skyscanner's Design System
*
* Copyright 2016 Skyscanner Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* stylelint-disable at-rule-disallowed-list */
@import 'tokens.scss';
@import 'radii.scss';
@import 'shadows.scss';
@import 'utils.scss';
////
/// @group cards
////
/// Basic card.
///
/// @example scss
/// .selector {
/// @include bpk-card();
/// }
@mixin bpk-card {
position: relative;
display: block;
background-color: $bpk-card-background-color;
color: $bpk-text-primary-day;
text-decoration: none;
cursor: pointer;
@include bpk-box-shadow-sm;
@include bpk-border-radius-md;
@include bpk-hover {
&::after {
opacity: 1;
}
}
// Keep transitions and animations to only transform and opacity.
// This pseudo element solution allows us to animate box-shadow in a performant manner.
// http://tobiasahlin.com/blog/how-to-animate-box-shadow/
&::after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
content: '';
transition: opacity $bpk-duration-sm ease-in-out;
opacity: 0;
pointer-events: none; // To prevent the pseudo element absorbing click events
@include bpk-box-shadow-lg;
@include bpk-border-radius-md;
// pointer-events doesn't work on ie
@media screen\0 {
z-index: -1;
}
}
&:active::after {
box-shadow: none;
}
}
/// Adds padding to cards. Modifies the bpk-card mixin.
///
/// @require {mixin} bpk-card
///
/// @example scss
/// .selector {
/// @include bpk-card();
/// @include bpk-card--padded();
/// }
@mixin bpk-card--padded {
padding: $bpk-card-padding;
}