Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions assets/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
.@{prefixCls} {
&-content {
height: 0;
opacity: 0;
transition-duration: .3s;
transition-timing-function: ease-in;
// transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
overflow: hidden;
> p, > div {
& > &-box {
margin-top: 16px;
margin-bottom: 16px;
}
Expand Down
52 changes: 33 additions & 19 deletions assets/index/ant.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@prefixCls: rc-collapse;
@borderStyle: 1px solid #d9d9d9;
@borderStyle: 1px solid #e9e9e9;

#arrow {
.common(){
Expand All @@ -22,40 +22,54 @@
}

.@{prefixCls} {
background-color: #f3f5f7;
background-color: #fbfbfb;
border-radius: 3px;
border-top: @borderStyle;
border-left: @borderStyle;
border-right: @borderStyle;

&-header {
height: 38px;
line-height: 38px;
text-indent: 16px;
color: #666;
border-bottom: @borderStyle;
&:before {
display: inline-block;
content: '\20';
#arrow > .common();
#arrow > .right(3px, 4px, #666);
vertical-align: middle;
margin-right: 8px;
& > &-item {
> .@{prefixCls}-header {
height: 38px;
line-height: 38px;
text-indent: 16px;
color: #666;
border-bottom: @borderStyle;
&:before {
display: inline-block;
content: '\20';
#arrow > .common();
#arrow > .right(3px, 4px, #666);
vertical-align: middle;
margin-right: 8px;
}
}
}

&-content {
color: #999;
padding: 0 16px;
background-color: #fbfbfb;
background-color: #f4f4f4;
}

&-item:last-child {
> .@{prefixCls}-content {
border-radius: 0 0 3px 3px;
}
}

&-content-active {
border-bottom: @borderStyle;
}
&-item-active {
.@{prefixCls}-header::before {
#arrow > .bottom(3px, 4px, #666);

& > &-item-active {
> .@{prefixCls}-header {
border-bottom: none;

&:before {
#arrow > .bottom(3px, 4px, #666);
margin-right: 6px;
}
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-collapse",
"version": "1.2.1",
"version": "1.2.2",
"description": "rc-collapse ui component for react",
"keywords": [
"react",
Expand Down
15 changes: 7 additions & 8 deletions src/Panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ module.exports = createClass({

return (
<div className={itemCls}>
<div className={headerCls} onClick={this.handleItemClick}>{header}</div>
<div className={contentCls} ref="content">{children}</div>
<div className={headerCls} onClick={this.handleItemClick}
role="tab" aria-expanded={isActive}>{header}</div>
<div className={contentCls} ref="content" role="tabpanel">
<div className={`${prefixCls}-content-box`}>{children}</div>
</div>
</div>
);
},
Expand All @@ -59,7 +62,6 @@ module.exports = createClass({
if (this.props.isActive) {
var el = findDOMNode(this.refs.content);
el.style.height = 'auto';
el.style.opacity = 1;
}
},

Expand All @@ -81,15 +83,12 @@ module.exports = createClass({

// start state
el.style.height = opacity ? scrollHeight : 0;
el.style.opacity = opacity;

cssAnimation.setTransition(el, 'Property', 'height ,opacity');
cssAnimation.setTransition(el, 'Property', 'height');
cssAnimation.style(el, {
height: opacity ? 0 : scrollHeight,
opacity: opacity ? 0 : 1
height: opacity ? 0 : scrollHeight
}, function() {
el.style.height = opacity ? 0 : 'auto';
el.style.opacity = opacity ? 0 : 1;
cssAnimation.setTransition(el, 'Property', '');
});
}
Expand Down