-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathArrow.svelte
65 lines (61 loc) · 1.51 KB
/
Arrow.svelte
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
<script>
import { NEXT, PREV } from '../../direction'
/**
* Indicates direction of the arrow ('next', 'prev')
*/
export let direction = NEXT
/**
* Indicates if button disabled
*/
export let disabled = false
</script>
<button
class="sc-carousel-button sc-carousel-arrow__circle"
class:sc-carousel-arrow__circle_disabled={disabled}
on:click
type="button"
>
<i
class="sc-carousel-arrow__arrow"
class:sc-carousel-arrow__arrow-next={direction === NEXT}
class:sc-carousel-arrow__arrow-prev={direction === PREV}
></i>
</button>
<style>
:root {
--sc-arrow-size: 2px;
}
.sc-carousel-arrow__circle {
width: 20px;
height: 20px;
border-radius: 50%;
background-color: var(--sc-color-rgb-light-50p);
display: flex;
align-items: center;
justify-content: center;
transition: opacity 100ms ease;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.sc-carousel-arrow__circle:hover {
opacity: 0.9;
}
.sc-carousel-arrow__arrow {
border: solid var(--sc-color-hex-dark);
border-width: 0 var(--sc-arrow-size) var(--sc-arrow-size) 0;
padding: var(--sc-arrow-size);
position: relative;
}
.sc-carousel-arrow__arrow-next {
transform: rotate(-45deg);
left: calc(var(--sc-arrow-size) / -2);
}
.sc-carousel-arrow__arrow-prev {
transform: rotate(135deg);
right: calc(var(--sc-arrow-size) / -2);
}
.sc-carousel-arrow__circle_disabled,
.sc-carousel-arrow__circle_disabled:hover {
opacity: 0.5;
}
</style>