chore: rename prop specialTriggerStyle to zeroWidthTriggerStyle

This commit is contained in:
orzyyyy 2019-10-06 17:39:54 +08:00 committed by 偏右
parent 4a29aaaf6b
commit 718a86d56b
4 changed files with 8 additions and 8 deletions

View File

@ -52,7 +52,7 @@ export interface SiderProps extends React.HTMLAttributes<HTMLDivElement> {
defaultCollapsed?: boolean;
reverseArrow?: boolean;
onCollapse?: (collapsed: boolean, type: CollapseType) => void;
specialTriggerStyle?: React.CSSProperties;
zeroWidthTriggerStyle?: React.CSSProperties;
trigger?: React.ReactNode;
width?: number | string;
collapsedWidth?: number | string;
@ -187,7 +187,7 @@ class InternalSider extends React.Component<InternalSideProps, SiderState> {
style,
width,
collapsedWidth,
specialTriggerStyle,
zeroWidthTriggerStyle,
...others
} = this.props;
const prefixCls = getPrefixCls('layout-sider', customizePrefixCls);
@ -198,7 +198,7 @@ class InternalSider extends React.Component<InternalSideProps, SiderState> {
'breakpoint',
'onBreakpoint',
'siderHook',
'specialTriggerStyle',
'zeroWidthTriggerStyle',
]);
const rawWidth = this.state.collapsed ? collapsedWidth : width;
// use "px" as fallback unit for width
@ -211,7 +211,7 @@ class InternalSider extends React.Component<InternalSideProps, SiderState> {
className={`${prefixCls}-zero-width-trigger ${prefixCls}-zero-width-trigger-${
reverseArrow ? 'right' : 'left'
}`}
style={specialTriggerStyle}
style={zeroWidthTriggerStyle}
>
<Icon type="bars" />
</span>

View File

@ -186,9 +186,9 @@ describe('Sider', () => {
);
});
it('specialTriggerStyle should work', () => {
it('zeroWidthTriggerStyle should work', () => {
const wrapper = mount(
<Sider collapsedWidth={0} collapsible specialTriggerStyle={{ background: '#F96' }}>
<Sider collapsedWidth={0} collapsible zeroWidthTriggerStyle={{ background: '#F96' }}>
<Menu theme="dark" mode="inline" defaultSelectedKeys={['1']}>
<Menu.Item key="1">
<Icon type="user" />

View File

@ -95,12 +95,12 @@ The sidebar.
| defaultCollapsed | to set the initial status | boolean | false | |
| reverseArrow | reverse direction of arrow, for a sider that expands from the right | boolean | false | |
| style | to customize the styles | object | - | |
| specialTriggerStyle | to customize the styles of the special trigger that appears when collapsedWidth is 0 | object | - | 3.24.0 |
| theme | color theme of the sidebar | string: `light` `dark` | `dark` | 3.6.0 |
| trigger | specify the customized trigger, set to null to hide the trigger | string\|ReactNode | - | |
| width | width of the sidebar | number\|string | 200 | |
| onCollapse | the callback function, executed by clicking the trigger or activating the responsive layout | (collapsed, type) => {} | - | |
| onBreakpoint | the callback function, executed when [breakpoints](/components/grid#api) changed | (broken) => {} | - | 3.7.0 |
| zeroWidthTriggerStyle | to customize the styles of the special trigger that appears when `collapsedWidth` is 0 | object | - | 3.24.0 |
#### breakpoint width

View File

@ -96,12 +96,12 @@ title: Layout
| defaultCollapsed | 是否默认收起 | boolean | false | |
| reverseArrow | 翻转折叠提示箭头的方向,当 Sider 在右边时可以使用 | boolean | false | |
| style | 指定样式 | object | - | |
| specialTriggerStyle | 指定当 `collapsedWidth` 为 0 时出现的特殊 trigger 的样式 | object | - | 3.24.0 |
| theme | 主题颜色 | string: `light` `dark` | `dark` | 3.6.0 |
| trigger | 自定义 trigger设置为 null 时隐藏 trigger | string\|ReactNode | - | |
| width | 宽度 | number\|string | 200 | |
| onCollapse | 展开-收起时的回调函数,有点击 trigger 以及响应式反馈两种方式可以触发 | (collapsed, type) => {} | - | |
| onBreakpoint | 触发响应式布局[断点](/components/grid#api)时的回调 | (broken) => {} | - | 3.7.0 |
| zeroWidthTriggerStyle | 指定当 `collapsedWidth` 为 0 时出现的特殊 trigger 的样式 | object | - | 3.24.0 |
#### breakpoint width