forked from swiftlang/swift-docc-render
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPagerControl.vue
81 lines (68 loc) · 1.69 KB
/
PagerControl.vue
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
<!--
This source file is part of the Swift.org open source project
Copyright (c) 2024 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
-->
<template>
<button
:class="['pager-control', action]"
:aria-label="$t(`pager.control.navigate-${action}`)"
>
<ChevronRoundedIcon class="icon" />
</button>
</template>
<script>
import ChevronRoundedIcon from 'theme/components/Icons/ChevronRoundedIcon.vue';
const Action = {
previous: 'previous',
next: 'next',
};
export default {
name: 'PagerControl',
components: { ChevronRoundedIcon },
props: {
action: {
type: String,
required: true,
validator: a => Object.hasOwnProperty.call(Action, a),
},
},
Action,
};
</script>
<style scoped lang="scss">
@import 'docc-render/styles/_core.scss';
.pager-control {
align-items: center;
background: var(--control-color-fill, var(--color-fill));
border: 1px solid var(--control-color-fill, var(--color-grid));
border-radius: 50%;
display: flex;
height: var(--control-size, 1rem);
justify-content: center;
opacity: 1;
transition: opacity 0.15s ease-in-out;
width: var(--control-size, 1rem);
&[disabled] {
opacity: 0.6;
@include breakpoints-from(large) {
opacity: 0;
.with-compact-controls & {
opacity: 0.6;
}
}
}
}
.icon {
height: var(--control-icon-size, 50%);
width: var(--control-icon-size, 50%);
.pager-control.next & {
transform: scale(1, 1);
}
.pager-control.previous & {
transform: scale(-1, 1);
}
}
</style>