UNPKG

4.82 kBSCSSView Raw
1// Foundation for Sites by ZURB
2// foundation.zurb.com
3// Licensed under MIT Open Source
4
5////
6/// @group pagination
7////
8
9/// Font size of pagination items.
10/// @type Number
11$pagination-font-size: rem-calc(14) !default;
12
13/// Default bottom margin of the pagination object.
14/// @type Number
15$pagination-margin-bottom: $global-margin !default;
16
17/// Text color of pagination items.
18/// @type Color
19$pagination-item-color: $black !default;
20
21/// Padding inside of pagination items.
22/// @type Number
23$pagination-item-padding: rem-calc(3 10) !default;
24
25/// Right margin to separate pagination items.
26/// @type Number
27$pagination-item-spacing: rem-calc(1) !default;
28
29/// Default radius for pagination items.
30/// @type Number
31$pagination-radius: $global-radius !default;
32
33/// Background color of pagination items on hover.
34/// @type Color
35$pagination-item-background-hover: $light-gray !default;
36
37/// Background color of pagination item for the current page.
38/// @type Color
39$pagination-item-background-current: $primary-color !default;
40
41/// Text color of the pagination item for the current page.
42/// @type Color
43$pagination-item-color-current: $white !default;
44
45/// Text color of a disabled pagination item.
46/// @type Color
47$pagination-item-color-disabled: $medium-gray !default;
48
49/// Color of the ellipsis in a pagination menu.
50/// @type Color
51$pagination-ellipsis-color: $black !default;
52
53/// If `false`, don't display page number links on mobile, only next/previous links
54/// and optionally current page number.
55/// @type Boolean
56$pagination-mobile-items: false !default;
57
58/// If `true`, display the current page number on mobile even if `$pagination-mobile-items` is set to `false`.
59/// This parameter will only override the visibility setting of the current item for `$pagination-mobile-items: false;`,
60/// it will not affect the current page number visibility when `$pagination-mobile-items` is set to `true`.
61/// @type Boolean
62$pagination-mobile-current-item: false !default;
63
64/// If `true`, arrows are added to the next and previous links of pagination.
65/// @type Boolean
66$pagination-arrows: true !default;
67
68/// Adds styles for a pagination container. Apply this to a `<ul>`.
69@mixin pagination-container (
70 $margin-bottom: $pagination-margin-bottom,
71 $font-size: $pagination-font-size,
72 $spacing: $pagination-item-spacing,
73 $radius: $pagination-radius,
74 $color: $pagination-item-color,
75 $padding: $pagination-item-padding,
76 $background-hover: $pagination-item-background-hover
77) {
78 @include clearfix;
79 margin-#{$global-left}: 0;
80 margin-bottom: $margin-bottom;
81
82 // List item
83 li {
84 margin-#{$global-right}: $spacing;
85 border-radius: $radius;
86 font-size: $font-size;
87
88 @if $pagination-mobile-items {
89 display: inline-block;
90 }
91 @else {
92 display: none;
93
94 &:last-child,
95 &:first-child {
96 display: inline-block;
97 }
98
99 @if $pagination-mobile-current-item {
100 &.current {
101 display: inline-block;
102 }
103 }
104
105 @include breakpoint(medium) {
106 display: inline-block;
107 }
108 }
109 }
110
111 // Page links
112 a,
113 button {
114 display: block;
115 padding: $padding;
116 border-radius: $radius;
117 color: $color;
118
119 &:hover {
120 background: $background-hover;
121 }
122 }
123}
124
125/// Adds styles for the current pagination item. Apply this to an `<a>`.
126@mixin pagination-item-current (
127 $padding: $pagination-item-padding,
128 $background-current: $pagination-item-background-current,
129 $color-current: $pagination-item-color-current
130) {
131 padding: $padding;
132 background: $background-current;
133 color: $color-current;
134 cursor: default;
135}
136
137/// Adds styles for a disabled pagination item. Apply this to an `<a>`.
138@mixin pagination-item-disabled (
139 $padding: $pagination-item-padding,
140 $color: $pagination-item-color-disabled
141) {
142 padding: $padding;
143 color: $color;
144 cursor: not-allowed;
145
146 &:hover {
147 background: transparent;
148 }
149}
150
151/// Adds styles for an ellipsis for use in a pagination list.
152@mixin pagination-ellipsis (
153 $padding: $pagination-item-padding,
154 $color: $pagination-ellipsis-color
155) {
156 padding: $padding;
157 content: '\2026';
158 color: $color;
159}
160
161@mixin foundation-pagination {
162 .pagination {
163 @include pagination-container;
164
165 .current {
166 @include pagination-item-current;
167 }
168
169 .disabled {
170 @include pagination-item-disabled;
171 }
172
173 .ellipsis::after {
174 @include pagination-ellipsis;
175 }
176 }
177
178 @if $pagination-arrows {
179 .pagination-previous a::before,
180 .pagination-previous.disabled::before {
181 display: inline-block;
182 margin-#{$global-right}: 0.5rem;
183 content: '\00ab';
184 }
185
186 .pagination-next a::after,
187 .pagination-next.disabled::after {
188 display: inline-block;
189 margin-#{$global-left}: 0.5rem;
190 content: '\00bb';
191 }
192 }
193}