Skip to content

Commit

Permalink
feat(Pagination): support device
Browse files Browse the repository at this point in the history
  • Loading branch information
myronliu347 committed Aug 5, 2019
1 parent 67f0d49 commit 52054e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pagination/pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Pagination extends Component {
prefix: PropTypes.string,
pure: PropTypes.bool,
rtl: PropTypes.bool,
device: PropTypes.oneOf(['desktop', 'tablet', 'phone']),
className: PropTypes.string,
/**
* 自定义国际化文案对象
Expand Down Expand Up @@ -579,7 +580,8 @@ class Pagination extends Component {
prefix,
pure,
rtl,
type,
device,
type: paginationType,
size,
shape,
className,
Expand Down Expand Up @@ -612,6 +614,12 @@ class Pagination extends Component {
const sizeSelector = this.renderPageSizeSelector();
const isStart = pageSizePosition === 'start';

let type = paginationType;

if (device === 'phone' && type === 'normal') {
type = 'simple';
}

const classes = cx({
[`${prefix}pagination`]: true,
[`${prefix}${size}`]: size,
Expand Down
9 changes: 9 additions & 0 deletions test/pagination/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,4 +680,13 @@ describe('Pagination', () => {
)
);
});

it('should support device transfer type to simple', () => {
wrapper.setProps({
device: 'phone',
type: 'normal'
});

assert(wrapper.find('.next-simple').length > 0);
})
});

0 comments on commit 52054e1

Please sign in to comment.