替换掉bootstrap中tabs/collapse的动画

This commit is contained in:
catchonme 2019-08-13 18:50:53 +08:00
parent a09189723b
commit c70c4ac0c7
4 changed files with 31 additions and 6 deletions

View File

@ -40,4 +40,21 @@
&--collapsable &-header {
user-select: none;
}
> .collapse {
display: none;
&.in {
display: block;
visibility: visible;
}
}
> .collapsing {
position: relative;
height: 0;
overflow: hidden;
transition-property: height, visibility;
transition-duration: .35s;
transition-timing-function: ease;
}
}

View File

@ -64,6 +64,13 @@
&.is-active {
display: block;
}
&.fade {
opacity: 0;
transition: opacity .35s linear;
&.in {
opacity: 1;
}
}
}
&--line {

View File

@ -17,7 +17,7 @@ const collapseStyles: {
[EXITED]: 'collapse',
[EXITING]: 'collapsing',
[ENTERING]: 'collapsing',
[ENTERED]: 'collapse show',
[ENTERED]: 'collapse in',
};
export interface CollapseProps {

View File

@ -6,14 +6,16 @@
import React from 'react';
import { Schema } from '../types';
import Transition, { ENTERED, ENTERING } from 'react-transition-group/Transition';
import Transition, {ENTERED, ENTERING, EXITED, EXITING} from 'react-transition-group/Transition';
import { ClassNamesFn, themeable } from '../theme';
const transitionStyles: {
[propName: string]: string;
} = {
[ENTERING]: 'in',
[ENTERED]: 'in'
[EXITED]: 'fade',
[EXITING]: 'fade',
[ENTERING]: 'fade in',
[ENTERED]: 'fade in'
};
export interface TabProps extends Schema {
@ -174,7 +176,6 @@ export class Tab extends React.PureComponent<TabProps> {
transitionStyles[status],
activeKey === eventKey ? 'is-active' : '',
'Tabs-pane',
'fade',
className
)}
>