Skip to content

Commit

Permalink
Fixed #888 - Add expandIcon and collapseIcon props to Panel component
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed May 21, 2019
1 parent fcfea79 commit 4245373
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/panel/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export class Panel extends Component {
style: null,
className: null,
collapsed: null,
expandIcon: 'pi pi-plus',
collapseIcon: 'pi pi-minus',
onExpand: null,
onCollapse: null,
onToggle: null
Expand All @@ -25,6 +27,8 @@ export class Panel extends Component {
style: PropTypes.object,
className: PropTypes.string,
collapsed: PropTypes.bool,
expandIcon: PropTypes.string,
collapseIcon: PropTypes.string,
onExpand: PropTypes.func,
onCollapse: PropTypes.func,
onToggle: PropTypes.func
Expand Down Expand Up @@ -90,11 +94,12 @@ export class Panel extends Component {
if (this.props.toggleable) {
const id = this.id + '_label';
const ariaControls = this.id + '_content';
const toggleIcon = collapsed ? this.props.expandIcon : this.props.collapseIcon;

return (
<a href={'#' + ariaControls} className="p-panel-titlebar-icon p-panel-titlebar-toggler" onClick={this.toggle}
id={id} aria-controls={ariaControls} aria-expanded={!collapsed} role="tab">
<span className={classNames('pi', {'pi-plus': collapsed, 'pi-minus': !collapsed})}></span>
<span className={toggleIcon}></span>
</a>
);
}
Expand Down

0 comments on commit 4245373

Please sign in to comment.