Skip to content

Commit

Permalink
fix(Collapse): fix nested collapse icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkahn authored and tao1991123 committed Mar 6, 2019
1 parent c327961 commit 7a6842a
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docs/**/*
/index.js
/index-with-locales.js

*.scss
59 changes: 59 additions & 0 deletions docs/collapse/demo/nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 基本

- order: 6

:::lang=en-us
# Nested Collapse

- order: 6

:::


---

````jsx
import { Collapse } from '@alifd/next';

const Panel = Collapse.Panel;

ReactDOM.render(
<div>
<Collapse>
<Panel title="simple tile">
<Collapse>
<Panel title="simple tile">
<ul>
<li>Promotions are marketing campaigns ran by Marketplace</li>
<li>Participate to sale your products during that promotion and make a profit</li>
</ul>
</Panel>
<Panel title="What are Promotion Products?">
<ul>
<li>Promotion Products is a service that helps you to promote products you list on Marketplace during a certain time range</li>
<li>You can choose which products should be available for the promotion</li>
<li>Not all Products of you will be available, because Promotions will only attract certain Product areas</li>
</ul>
</Panel>
<Panel title="Why can i not submit a higher price?">
<ul>
<li>The Promotion requires a certain price to make sure that our customers are attracted</li>
</ul>
</Panel>
<Panel title="What is Promo Stock?">
Promo Stock is the criteria needed to be followed to be able to join Promotion. With setting particular Promo Stock value you commit to have this amount of stock available while Promotion is active.
</Panel>
</Collapse>
</Panel>
<Panel title="What are Promotion Products?">
<ul>
<li>Promotion Products is a service that helps you to promote products you list on Marketplace during a certain time range</li>
<li>You can choose which products should be available for the promotion</li>
<li>Not all Products of you will be available, because Promotions will only attract certain Product areas</li>
</ul>
</Panel>

</Collapse>
</div>,
mountNode);
````
4 changes: 3 additions & 1 deletion src/collapse/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@
height: auto;
opacity: 1;
}
}

#{$collapse-prefix}-panel-icon {
#{$collapse-prefix}-panel-icon {
&#{$collapse-prefix}-panel-icon-expanded {
@include icon-size($collapse-icon-size, 0, 0, rotate($collapse-icon-rotation-expanded));
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/collapse/panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ class Panel extends React.Component {
[className]: className,
});

const iconCls = classNames({
[`${prefix}collapse-panel-icon`]: true,
[`${prefix}collapse-panel-icon-expanded`]: isExpanded,
});

// 为了无障碍 需要添加两个id
const headingId = id ? `${id}-heading` : undefined;
const regionId = id ? `${id}-region` : undefined;
Expand All @@ -89,7 +94,7 @@ class Panel extends React.Component {
>
<Icon
type="arrow-up"
className={`${prefix}collapse-panel-icon`}
className={iconCls}
aria-hidden="true"
/>
{title}
Expand Down

0 comments on commit 7a6842a

Please sign in to comment.