Skip to content

Commit afb2619

Browse files
committed
fix: pagination mini size style
1 parent 2bf8599 commit afb2619

File tree

2 files changed

+76
-36
lines changed

2 files changed

+76
-36
lines changed

components/pagination/Pagination.tsx

+24-25
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default defineComponent({
8282
props: paginationProps(),
8383
// emits: ['change', 'showSizeChange', 'update:current', 'update:pageSize'],
8484
setup(props, { slots, attrs }) {
85-
const { prefixCls, configProvider, direction } = useConfigInject('pagination', props);
85+
const { prefixCls, configProvider, direction, size } = useConfigInject('pagination', props);
8686

8787
// style
8888
const [wrapSSR, hashId] = useStyle(prefixCls);
@@ -94,58 +94,54 @@ export default defineComponent({
9494
const [locale] = useLocaleReceiver('Pagination', enUS, toRef(props, 'locale'));
9595
const getIconsProps = (pre: string) => {
9696
const ellipsis = <span class={`${pre}-item-ellipsis`}>•••</span>;
97-
let prevIcon = (
97+
const prevIcon = (
9898
<button class={`${pre}-item-link`} type="button" tabindex={-1}>
99-
<LeftOutlined />
99+
{direction.value === 'rtl' ? <RightOutlined /> : <LeftOutlined />}
100100
</button>
101101
);
102-
let nextIcon = (
102+
const nextIcon = (
103103
<button class={`${pre}-item-link`} type="button" tabindex={-1}>
104-
<RightOutlined />
104+
{direction.value === 'rtl' ? <LeftOutlined /> : <RightOutlined />}
105105
</button>
106106
);
107-
let jumpPrevIcon = (
107+
const jumpPrevIcon = (
108108
<a rel="nofollow" class={`${pre}-item-link`}>
109-
{/* You can use transition effects in the container :) */}
110109
<div class={`${pre}-item-container`}>
111-
<DoubleLeftOutlined class={`${pre}-item-link-icon`} />
110+
{direction.value === 'rtl' ? (
111+
<DoubleRightOutlined class={`${pre}-item-link-icon`} />
112+
) : (
113+
<DoubleLeftOutlined class={`${pre}-item-link-icon`} />
114+
)}
112115
{ellipsis}
113116
</div>
114117
</a>
115118
);
116-
let jumpNextIcon = (
119+
const jumpNextIcon = (
117120
<a rel="nofollow" class={`${pre}-item-link`}>
118-
{/* You can use transition effects in the container :) */}
119121
<div class={`${pre}-item-container`}>
120-
<DoubleRightOutlined class={`${pre}-item-link-icon`} />
122+
{direction.value === 'rtl' ? (
123+
<DoubleLeftOutlined class={`${pre}-item-link-icon`} />
124+
) : (
125+
<DoubleRightOutlined class={`${pre}-item-link-icon`} />
126+
)}
121127
{ellipsis}
122128
</div>
123129
</a>
124130
);
125-
// change arrows direction in right-to-left direction
126-
if (direction.value === 'rtl') {
127-
[prevIcon, nextIcon] = [nextIcon, prevIcon];
128-
[jumpPrevIcon, jumpNextIcon] = [jumpNextIcon, jumpPrevIcon];
129-
}
130-
return {
131-
prevIcon,
132-
nextIcon,
133-
jumpPrevIcon,
134-
jumpNextIcon,
135-
};
131+
return { prevIcon, nextIcon, jumpPrevIcon, jumpNextIcon };
136132
};
137133

138134
return () => {
139135
const {
140-
size,
141136
itemRender = slots.itemRender,
142137
buildOptionText = slots.buildOptionText,
143138
selectComponentClass,
144139
responsive,
145140
...restProps
146141
} = props;
147142

148-
const isSmall = size === 'small' || !!(breakpoint.value?.xs && !size && responsive);
143+
const isSmall =
144+
size.value === 'small' || !!(breakpoint.value?.xs && !size.value && responsive);
149145
const paginationProps = {
150146
...restProps,
151147
...getIconsProps(prefixCls.value),
@@ -156,7 +152,10 @@ export default defineComponent({
156152
buildOptionText,
157153
...attrs,
158154
class: classNames(
159-
{ mini: isSmall, [`${prefixCls.value}-rtl`]: direction.value === 'rtl' },
155+
{
156+
[`${prefixCls.value}-mini`]: isSmall,
157+
[`${prefixCls.value}-rtl`]: direction.value === 'rtl',
158+
},
160159
attrs.class,
161160
hashId.value,
162161
),

components/pagination/style/index.tsx

+52-11
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,16 @@ const genPaginationDisabledStyle: GenerateStyle<PaginationToken, CSSObject> = to
5757

5858
[`&${componentCls}-disabled`]: {
5959
cursor: 'not-allowed',
60-
60+
[`&${componentCls}-mini`]: {
61+
[`
62+
&:hover ${componentCls}-item:not(${componentCls}-item-active),
63+
&:active ${componentCls}-item:not(${componentCls}-item-active),
64+
&:hover ${componentCls}-item-link,
65+
&:active ${componentCls}-item-link
66+
`]: {
67+
backgroundColor: 'transparent',
68+
},
69+
},
6170
[`${componentCls}-item`]: {
6271
cursor: 'not-allowed',
6372

@@ -89,26 +98,38 @@ const genPaginationDisabledStyle: GenerateStyle<PaginationToken, CSSObject> = to
8998
[`${componentCls}-item-link`]: {
9099
color: token.colorTextDisabled,
91100
cursor: 'not-allowed',
92-
93101
'&:hover, &:active': {
94102
backgroundColor: 'transparent',
95103
},
96-
97104
[`${componentCls}-simple&`]: {
98105
backgroundColor: 'transparent',
106+
'&:hover, &:active': {
107+
backgroundColor: 'transparent',
108+
},
99109
},
100110
},
101111

102-
[`${componentCls}-item-link-icon`]: {
103-
opacity: 0,
112+
[`${componentCls}-simple-pager`]: {
113+
color: token.colorTextDisabled,
104114
},
105115

106-
[`${componentCls}-item-ellipsis`]: {
107-
opacity: 1,
108-
},
116+
[`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
117+
[`${componentCls}-item-link-icon`]: {
118+
opacity: 0,
119+
},
109120

110-
[`${componentCls}-simple-pager`]: {
111-
color: token.colorTextDisabled,
121+
[`${componentCls}-item-ellipsis`]: {
122+
opacity: 1,
123+
},
124+
},
125+
},
126+
[`&${componentCls}-simple`]: {
127+
[`${componentCls}-prev, ${componentCls}-next`]: {
128+
[`&${componentCls}-disabled ${componentCls}-item-link`]: {
129+
'&:hover, &:active': {
130+
backgroundColor: 'transparent',
131+
},
132+
},
112133
},
113134
},
114135
};
@@ -134,13 +155,28 @@ const genPaginationMiniStyle: GenerateStyle<PaginationToken, CSSObject> = token
134155
[`&${componentCls}-mini ${componentCls}-item:not(${componentCls}-item-active)`]: {
135156
backgroundColor: 'transparent',
136157
borderColor: 'transparent',
158+
'&:hover': {
159+
backgroundColor: token.colorBgTextHover,
160+
},
161+
'&:active': {
162+
backgroundColor: token.colorBgTextActive,
163+
},
137164
},
138165

139166
[`&${componentCls}-mini ${componentCls}-prev, &${componentCls}-mini ${componentCls}-next`]: {
140167
minWidth: token.paginationItemSizeSM,
141168
height: token.paginationItemSizeSM,
142169
margin: 0,
143170
lineHeight: `${token.paginationItemSizeSM}px`,
171+
[`&:hover ${componentCls}-item-link`]: {
172+
backgroundColor: token.colorBgTextHover,
173+
},
174+
[`&:active ${componentCls}-item-link`]: {
175+
backgroundColor: token.colorBgTextActive,
176+
},
177+
[`&${componentCls}-disabled:hover ${componentCls}-item-link`]: {
178+
backgroundColor: 'transparent',
179+
},
144180
},
145181

146182
[`
@@ -200,7 +236,12 @@ const genPaginationSimpleStyle: GenerateStyle<PaginationToken, CSSObject> = toke
200236
height: token.paginationItemSizeSM,
201237
backgroundColor: 'transparent',
202238
border: 0,
203-
239+
'&:hover': {
240+
backgroundColor: token.colorBgTextHover,
241+
},
242+
'&:active': {
243+
backgroundColor: token.colorBgTextActive,
244+
},
204245
'&::after': {
205246
height: token.paginationItemSizeSM,
206247
lineHeight: `${token.paginationItemSizeSM}px`,

0 commit comments

Comments
 (0)