Skip to content

Commit

Permalink
feat: jumper 更名为 paginationMini 组件 (#1749)
Browse files Browse the repository at this point in the history
* feat: jumper 更名为 paginationMini 组件

* feat: jumper 更名为 paginationMini 组件

* feat: jumper 更名为 paginationMini 组件

* feat: jumper 更名为 paginationMini 组件
  • Loading branch information
honkinglin committed Nov 25, 2022
1 parent f161ef4 commit 9cb8917
Show file tree
Hide file tree
Showing 22 changed files with 637 additions and 1,136 deletions.
6 changes: 0 additions & 6 deletions site/site.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ export default {
path: '/react/components/dropdown',
component: () => import('tdesign-react/dropdown/dropdown.md'),
},
{
title: 'Jumper 跳转',
name: 'jumper',
path: '/react/components/jumper',
component: () => import('tdesign-react/jumper/jumper.md'),
},
{
title: 'Menu 导航',
name: 'menu',
Expand Down
6 changes: 3 additions & 3 deletions src/date-picker/base/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { useLocaleReceiver } from '../../locale/LocalReceiver';
import useConfig from '../../hooks/useConfig';
import Select from '../../select';
import { TdDatePickerProps } from '../type';
import Jumper, { TdJumperProps } from '../../jumper';
import { PaginationMini, TdPaginationMiniProps } from '../../pagination';

export interface DatePickerHeaderProps extends Pick<TdDatePickerProps, 'mode'> {
year?: number;
month?: number;
onMonthChange?: Function;
onYearChange?: Function;
onJumperClick?: TdJumperProps['onChange'];
onJumperClick?: TdPaginationMiniProps['onChange'];
}

const useDatePickerLocalConfig = () => {
Expand Down Expand Up @@ -221,7 +221,7 @@ const DatePickerHeader = (props: DatePickerHeaderProps) => {
/>
</div>

<Jumper tips={labelMap[mode]} size="small" onChange={onJumperClick} />
<PaginationMini tips={labelMap[mode]} size="small" onChange={onJumperClick} />
</div>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export * from './range-input';
export * from './watermark';
export * from './image-viewer';
export * from './space';
export * from './jumper';
export * from './timeline';
export * from './image';
export * from './rate';
Expand Down
10 changes: 0 additions & 10 deletions src/jumper/__tests__/jumper.test.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/jumper/_example/layout.jsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/jumper/_example/size.jsx

This file was deleted.

7 changes: 0 additions & 7 deletions src/jumper/_example/tips.jsx

This file was deleted.

48 changes: 0 additions & 48 deletions src/jumper/_usage/index.jsx

This file was deleted.

63 changes: 0 additions & 63 deletions src/jumper/_usage/props.json

This file was deleted.

12 changes: 0 additions & 12 deletions src/jumper/defaultProps.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/jumper/index.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/jumper/jumper.md

This file was deleted.

1 change: 0 additions & 1 deletion src/jumper/style/css.js

This file was deleted.

1 change: 0 additions & 1 deletion src/jumper/style/index.js

This file was deleted.

49 changes: 0 additions & 49 deletions src/jumper/type.ts

This file was deleted.

24 changes: 12 additions & 12 deletions src/jumper/Jumper.tsx → src/pagination/PaginationMini.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import useConfig from '../hooks/useConfig';
import useGlobalIcon from '../hooks/useGlobalIcon';
import Button from '../button';
import { StyledProps } from '../common';
import type { TdJumperProps } from './type';
import { jumperDefaultProps } from './defaultProps';
import type { TdPaginationMiniProps } from './type';
import { paginationMiniDefaultProps } from './defaultProps';
import noop from '../_util/noop';

export interface JumperProps extends TdJumperProps, StyledProps {}
export interface PaginationMiniProps extends TdPaginationMiniProps, StyledProps {}

const Jumper = forwardRef((props: JumperProps, ref: React.Ref<HTMLDivElement>) => {
const PaginationMini = forwardRef((props: PaginationMiniProps, ref: React.Ref<HTMLDivElement>) => {
const { classPrefix } = useConfig();
const { RoundIcon, ChevronUpIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } = useGlobalIcon({
RoundIcon: TdRoundIcon,
Expand All @@ -44,8 +44,8 @@ const Jumper = forwardRef((props: JumperProps, ref: React.Ref<HTMLDivElement>) =

return (
<div
className={classNames(`${classPrefix}-jumper`, className, {
[`${classPrefix}-jumper--outline`]: variant === 'outline',
className={classNames(`${classPrefix}-pagination-mini`, className, {
[`${classPrefix}-pagination-mini--outline`]: variant === 'outline',
})}
ref={ref}
style={style}
Expand All @@ -57,7 +57,7 @@ const Jumper = forwardRef((props: JumperProps, ref: React.Ref<HTMLDivElement>) =
shape="square"
onClick={(e) => onChange({ e, trigger: 'prev' })}
icon={layout === 'horizontal' ? <ChevronLeftIcon /> : <ChevronUpIcon />}
className={`${classPrefix}-jumper__prev`}
className={`${classPrefix}-pagination-mini__prev`}
disabled={disabledConfig.prev}
/>

Expand All @@ -69,7 +69,7 @@ const Jumper = forwardRef((props: JumperProps, ref: React.Ref<HTMLDivElement>) =
shape="square"
onClick={(e) => onChange({ e, trigger: 'current' })}
icon={<RoundIcon />}
className={`${classPrefix}-jumper__current`}
className={`${classPrefix}-pagination-mini__current`}
disabled={disabledConfig.current}
/>
)}
Expand All @@ -81,14 +81,14 @@ const Jumper = forwardRef((props: JumperProps, ref: React.Ref<HTMLDivElement>) =
shape="square"
onClick={(e) => onChange({ e, trigger: 'next' })}
icon={layout === 'horizontal' ? <ChevronRightIcon /> : <ChevronDownIcon />}
className={`${classPrefix}-jumper__next`}
className={`${classPrefix}-pagination-mini__next`}
disabled={disabledConfig.next}
/>
</div>
);
});

Jumper.displayName = 'Jumper';
Jumper.defaultProps = jumperDefaultProps;
PaginationMini.displayName = 'PaginationMini';
PaginationMini.defaultProps = paginationMiniDefaultProps;

export default Jumper;
export default PaginationMini;
30 changes: 30 additions & 0 deletions src/pagination/_example/pagination-mini.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { useState } from 'react';
import { Radio, PaginationMini, Space } from 'tdesign-react';

export default function DemoPaginationMini() {
const [layout, setLayout] = useState('vertical');
const [size, setSize] = useState('medium');

const tips = { prev: '前尘忆梦', current: '回到现在', next: '展望未来' };

return (
<Space direction="vertical" size={16}>
<Space align="center">
<span>layout:</span>
<Radio.Group value={layout} onChange={setLayout} variant="default-filled">
<Radio.Button value="vertical">vertical</Radio.Button>
<Radio.Button value="horizontal">horizontal</Radio.Button>
</Radio.Group>
</Space>
<Space align="center">
<span>size:</span>
<Radio.Group value={size} onChange={setSize} variant="default-filled">
<Radio.Button value="small">small</Radio.Button>
<Radio.Button value="medium">medium</Radio.Button>
<Radio.Button value="large">large</Radio.Button>
</Radio.Group>
</Space>
<PaginationMini layout={layout} size={size} tips={tips} />
</Space>
)
}
Loading

0 comments on commit 9cb8917

Please sign in to comment.