Skip to content

Commit 4f93557

Browse files
committed
Add inheritance overrides example
1 parent 6ccf6b1 commit 4f93557

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
"autoprefixer-core": "^5.1.11",
2222
"babel-core": "^5.2.17",
2323
"babel-loader": "^5.0.0",
24-
"css-loader": "^0.14.0",
24+
"css-loader": "^0.14.3",
2525
"ejs": "^2.3.1",
26-
"extract-text-webpack-plugin": "^0.8.0",
26+
"extract-text-webpack-plugin": "^0.8.1",
2727
"node-libs-browser": "^0.5.0",
2828
"postcss-color-rebeccapurple": "^1.1.0",
2929
"postcss-loader": "^0.4.3",
3030
"react": "^0.13.3",
3131
"react-to-html-webpack-plugin": "^2.1.0",
3232
"style-loader": "^0.12.2",
33-
"webpack": "^1.9.8",
33+
"webpack": "^1.9.10",
3434
"webpack-dev-server": "^1.8.2"
3535
}
3636
}

src/components/App.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import React, { Component } from 'react';
33
import HelloWorld from './HelloWorld/HelloWorld';
44
import FooBar from './FooBar/FooBar';
55

6+
import InheritanceOverrides from './InheritanceOverrides/InheritanceOverrides';
7+
68
import BouncingBall from './BouncingBall/BouncingBall';
79

810
export default class App extends Component {
@@ -20,6 +22,10 @@ export default class App extends Component {
2022
<br />
2123
<FooBar />
2224

25+
<p>When extending classes, <strong>inherited style properties can be overridden</strong> as you'd expect.</p>
26+
<p>The following component extends two different classes, but provides overrides which then take precedence.</p>
27+
<InheritanceOverrides />
28+
2329
<p>CSS Modules even provide <strong>locally scoped animations</strong>, which are typically defined in the global scope.</p>
2430
<p>The following <strong>BouncingBall</strong> component extends a <strong>".bounce"</strong> class from a separate animations module.</p>
2531
<p>The <strong>"bounce"</strong> keyframes are private to the animations module, only exposed via the <strong>".bounce"</strong> class to those that either extend from it or import it.</p>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.root {
2+
extends: box from "styles/layout.css";
3+
border-style: dotted;
4+
border-color: green;
5+
}
6+
7+
.text {
8+
extends: heading from "styles/typography.css";
9+
font-weight: 200;
10+
color: green;
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import styles from './InheritanceOverrides.css';
2+
3+
import React, { Component } from 'react';
4+
5+
export default class InheritanceOverrides extends Component {
6+
7+
render() {
8+
return (
9+
<div className={styles.root}>
10+
<p className={styles.text}>Inherited Styles with Overrides</p>
11+
</div>
12+
);
13+
}
14+
15+
};

0 commit comments

Comments
 (0)