Skip to content

Commit 12f4f1b

Browse files
committed
Update button group and example to SLDS 0.11.0
1 parent 152e5a8 commit 12f4f1b

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

components/SLDSButton/SLDSButtonStateful/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class SLDSButtonStateful extends React.Component {
8080
else if(this.props.type === "icon") {
8181
return (
8282
<button className={this.getClassName()} onClick={this.handleClick.bind(this)}>
83-
<ButtonIcon disabled={this.props.disabled} name="like" size="large" className="slds-button__icon--stateful" />
83+
<ButtonIcon disabled={this.props.disabled} name={this.props.iconName} size={this.props.iconSize} assistiveText={this.props.assistiveText} className="slds-button__icon--stateful" />
8484
</button>
8585
)
8686
}

components/SLDSIcons.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ import SLDSUtilityIcon from './SLDSUtilityIcon';
1717
export const ButtonIcon = React.createClass({
1818

1919
getDefaultProps() {
20-
2120
return {
2221
category: 'utility', // Utility Icon Reference: https://www.lightningdesignsystem.com/resources/icons#utility
2322
};
2423
},
2524

2625
render() {
27-
2826
let className = 'slds-button__icon';
27+
let label = null;
28+
2929
if (this.props.position) {
3030
//If no position prop given, default to left
3131
className += ' slds-button__icon--' + this.props.position;
@@ -36,13 +36,15 @@ export const ButtonIcon = React.createClass({
3636
if (this.props.destructive) {
3737
className += ' slds-button__icon--destructive';
3838
}
39-
/*
40-
if(this.props.category === 'utility'){
41-
return <SLDSUtilityIcon name={this.props.name} aria-hidden='true' className={className} />;
39+
if (this.props.assistiveText) {
40+
label = <span className="slds-assistive-text">{this.props.assistiveText}</span>;
4241
}
43-
return <svg aria-hidden='true' className={className} dangerouslySetInnerHTML={{__html: useTag }} />;
44-
*/
45-
return <SLDSUtilityIcon name={this.props.name} category={this.props.category} aria-hidden='true' className={className} />;
42+
return (
43+
<span>
44+
{label}
45+
<SLDSUtilityIcon name={this.props.name} category={this.props.category} aria-hidden='true' className={className} />
46+
</span>
47+
)
4648

4749

4850
}

demo/pages/HomePage/ButtonGroupSection.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import React from 'react';
1414
import SLDSButtonGroup from '../../../components/SLDSButtonGroup';
1515
import SLDSDropdownBase from '../../../components/SLDSDropdownBase';
1616
import SLDSButton from '../../../components/SLDSButton';
17+
import SLDSButtonStateful from '../../../components/SLDSButton/SLDSButtonStateful';
1718
import {ButtonIcon, Icon} from "./../../../components/SLDSIcons";
1819
import {default as PrismCode} from "react-prism/lib/PrismCode";
1920

@@ -80,8 +81,8 @@ module.exports = React.createClass( {
8081

8182
<div className='slds-p-vertical--small'>
8283
<SLDSButtonGroup>
83-
<SLDSButton label='Chart' variant='icon' iconName='chart' iconVariant='border'/>
84-
<SLDSButton label='Filter' variant='icon' iconName='filter' iconVariant='border'/>
84+
<SLDSButtonStateful type="icon" assistiveText="View Reports" label='Chart' variant='icon' iconName='chart' />
85+
<SLDSButtonStateful type="icon" assistiveText="Filter Data" label='Filter' variant='icon' iconName='filter' />
8586
<SLDSButton label='Sort' variant='icon' iconName='sort' iconVariant='more'/>
8687
</SLDSButtonGroup>
8788
</div>

0 commit comments

Comments
 (0)