Skip to content

Commit a907966

Browse files
committed
minor fix
1 parent f2240f0 commit a907966

File tree

4 files changed

+57
-35
lines changed

4 files changed

+57
-35
lines changed

lib/SLDSIcons.js

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Redistributions in binary form must reproduce the above copyright notice, this l
66
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
77
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88
*/
9-
109
'use strict';
1110

1211
Object.defineProperty(exports, '__esModule', {
@@ -19,32 +18,38 @@ var _react = require('react');
1918

2019
var _react2 = _interopRequireDefault(_react);
2120

21+
var _SLDSSettings = require('./SLDSSettings');
22+
23+
var _SLDSSettings2 = _interopRequireDefault(_SLDSSettings);
24+
2225
var ButtonIcon = _react2['default'].createClass({
2326
displayName: 'ButtonIcon',
2427

2528
getDefaultProps: function getDefaultProps() {
29+
2630
return {
27-
category: "utility"
31+
category: 'utility'
2832
};
2933
},
3034

3135
render: function render() {
32-
var useTag = '<use xlink:href="assets/icons/' + this.props.category + '-sprite/svg/symbols.svg#' + this.props.name + '" />';
33-
var className = "slds-button__icon";
36+
37+
var useTag = '<use xlink:href="' + _SLDSSettings2['default'].getAssetsPath() + '/icons/' + this.props.category + '-sprite/svg/symbols.svg#' + this.props.name + '" />';
38+
var className = 'slds-button__icon';
3439
if (this.props.stateful) {
35-
className += "--stateful";
40+
className += '--stateful';
3641
}
3742
if (this.props.position) {
38-
className = className + " slds-button__icon--" + this.props.position;
43+
className = className + ' slds-button__icon--' + this.props.position;
3944
}
4045
if (this.props.size) {
41-
className = className + " slds-button__icon--" + this.props.size;
46+
className = className + ' slds-button__icon--' + this.props.size;
4247
}
4348
if (this.props.inverse) {
44-
className = className + " slds-button__icon--inverse";
49+
className = className + ' slds-button__icon--inverse';
4550
}
4651
if (this.props.hint) {
47-
className = className + " slds-button__icon--hint";
52+
className = className + ' slds-button__icon--hint';
4853
}
4954
return _react2['default'].createElement('svg', { 'aria-hidden': 'true', className: className, dangerouslySetInnerHTML: { __html: useTag } });
5055
}
@@ -57,26 +62,27 @@ var Icon = _react2['default'].createClass({
5762

5863
getDefaultProps: function getDefaultProps() {
5964
return {
60-
category: "standard"
65+
category: 'standard'
6166
};
6267
},
6368

6469
render: function render() {
65-
var useTag = '<use xlink:href="assets/icons/' + this.props.category + '-sprite/svg/symbols.svg#' + this.props.name + '" />';
66-
var className = "slds-icon";
70+
71+
var useTag = '<use xlink:href="' + _SLDSSettings2['default'].getAssetsPath() + '/icons/' + this.props.category + '-sprite/svg/symbols.svg#' + this.props.name + '" />';
72+
var className = 'slds-icon';
6773
if (this.props.stateful) {
68-
className += "--stateful";
74+
className += '--stateful';
6975
}
7076
if (this.props.className) {
71-
className += " " + this.props.className;
77+
className += ' ' + this.props.className;
7278
}
7379
if (this.props.size) {
74-
className += " slds-icon--" + this.props.size;
80+
className += ' slds-icon--' + this.props.size;
7581
}
7682
if (this.props.position) {
77-
className += " slds-icon--" + this.props.position;
83+
className += ' slds-icon--' + this.props.position;
7884
}
79-
className = className + " slds-icon-" + this.props.category + '-' + (this.props.theme || this.props.name);
85+
className = className + ' slds-icon-' + this.props.category + '-' + (this.props.theme || this.props.name);
8086
return _react2['default'].createElement(
8187
'span',
8288
{ className: 'slds-icon__container' },
@@ -91,8 +97,8 @@ var InputIcon = _react2['default'].createClass({
9197
displayName: 'InputIcon',
9298

9399
render: function render() {
94-
var useTag = '<use xlink:href="assets/icons/utility-sprite/svg/symbols.svg#' + this.props.name + '" />';
95-
var className = "slds-input__icon slds-icon-text-default";
100+
var useTag = '<use xlink:href="' + _SLDSSettings2['default'].getAssetsPath() + 'icons/utility-sprite/svg/symbols.svg#' + this.props.name + '" />';
101+
var className = 'slds-input__icon slds-icon-text-default';
96102
return _react2['default'].createElement('svg', { 'aria-hidden': 'true', className: className, dangerouslySetInnerHTML: { __html: useTag } });
97103
}
98104

lib/SLDSSettings.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1111

1212
'use strict';
1313

14-
Object.defineProperty(exports, '__esModule', {
15-
value: true
16-
});
17-
exports['default'] = {
18-
assetsPath: 'assets'
19-
};
20-
module.exports = exports['default'];
14+
var assetsPath = 'assets/';
15+
16+
module.exports = {
17+
setAssetsPath: function setAssetsPath(path) {
18+
if (path) {
19+
assetsPath = path;
20+
}
21+
},
22+
getAssetsPath: function getAssetsPath() {
23+
return String(assetsPath);
24+
}
25+
};

lib/index.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
'use strict';
1+
/*
2+
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7+
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8+
9+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10+
*/
211

3-
Object.defineProperty(exports, '__esModule', {
4-
value: true
5-
});
12+
'use strict';
613

714
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
815

916
var _SLDSPicklistBase = require('./SLDSPicklistBase');
1017

1118
var _SLDSPicklistBase2 = _interopRequireDefault(_SLDSPicklistBase);
1219

13-
exports['default'] = {
14-
SLDSPicklistBase: _SLDSPicklistBase2['default']
15-
};
16-
module.exports = exports['default'];
20+
var _SLDSSettings = require('./SLDSSettings');
21+
22+
var _SLDSSettings2 = _interopRequireDefault(_SLDSSettings);
23+
24+
module.exports = {
25+
SLDSPicklistBase: _SLDSPicklistBase2['default'],
26+
SLDSSettings: _SLDSSettings2['default']
27+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "design-system-react",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "Salesforce Lightning Design System React components",
55
"scripts": {
66
"start": "node server.js",

0 commit comments

Comments
 (0)