Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 2585427

Browse files
committed
Various updates
- Additional example in button docs; - ESLint setup;
1 parent a5172b1 commit 2585427

File tree

6 files changed

+42
-3
lines changed

6 files changed

+42
-3
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.eslintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/topcoder-react-utils/config/eslint/default.json"
3+
}

docs/buttons.md

+32
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,47 @@ to further use them for your custom styling, you can find them in the
2424
folder.
2525

2626
### <a name="examples">Examples</a>
27+
The minimal example:
28+
```jsx
29+
import { PrimaryButton } from 'topcoder-react-ui-kit`;
30+
import React from 'react';
31+
32+
export default function() {
33+
return (
34+
<PrimaryButton
35+
onClick={() => console.log('PrimaryButton was clicked!')}
36+
>Click Me!</PrimaryButton>
37+
);
38+
}
39+
```
40+
41+
If you need some ad-hoc styling, here is the minimal example:
42+
```scss
43+
// style.scss
44+
45+
.myButton {
46+
// In this example we override the default margins around the button. Pay
47+
// attention to the "!important" instruction, it should be added for each
48+
// attribute of the ad-hoc style, to ensure that resulting styling does not
49+
// depend on the order of SCSS rules in the generated CSS bundle (i.e. that
50+
// the ad-hoc style has the highest priority, no matter the order).
51+
margin: 40px 0 !important;
52+
}
53+
```
2754
2855
```jsx
56+
// button.jsx
57+
2958
import { PrimaryButton } from 'topcoder-react-ui-kit`;
3059
import React from 'react';
3160
61+
import style from './style.scss';
62+
3263
export default function() {
3364
return (
3465
<PrimaryButton
3566
onClick={() => console.log('PrimaryButton was clicked!')}
67+
theme={{ button: style.myButton }}
3668
>Click Me!</PrimaryButton>
3769
);
3870
}

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
"build": "npm run clean && ./node_modules/.bin/webpack --env=production --progress --profile --colors --display-optimization-bailout",
2525
"build:dev": "npm run clean && webpack --env=development --progress --profile --colors --display-optimization-bailout --bail --watch",
2626
"clean": "rimraf dist",
27-
"prepublishOnly": "npm run build"
27+
"lint": "npm run lint:js",
28+
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
29+
"prepublishOnly": "npm run build",
30+
"test": "npm run lint"
2831
},
2932
"version": "0.0.4",
3033
"dependencies": {

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'styles/global';
1+
import 'styles/global.scss';
22

33
import * as buttons from 'components/buttons';
44

webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
module.exports = function buildConfig(env) {
55
return require(`./config/webpack/${env}.js`);
6-
}
6+
};

0 commit comments

Comments
 (0)