Skip to content

Commit 52d7793

Browse files
committed
added css modules with themes configuraiton
1 parent 8e1ce39 commit 52d7793

File tree

6 files changed

+106
-37
lines changed

6 files changed

+106
-37
lines changed

jspm.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ SystemJS.config({
168168
"classnames": "npm:classnames@2.2.5",
169169
"constants": "github:jspm/nodelibs-constants@0.2.0-alpha",
170170
"crypto": "github:jspm/nodelibs-crypto@0.2.0-alpha",
171+
"csjs": "npm:csjs@1.0.6",
171172
"domain": "github:jspm/nodelibs-domain@0.2.0-alpha",
172173
"events": "github:jspm/nodelibs-events@0.2.0-alpha",
173174
"fs": "github:jspm/nodelibs-fs@0.2.0-alpha",
174175
"http": "github:jspm/nodelibs-http@0.2.0-alpha",
175176
"https": "github:jspm/nodelibs-https@0.2.0-alpha",
177+
"insert-css": "npm:insert-css@1.0.0",
176178
"os": "github:jspm/nodelibs-os@0.2.0-alpha",
177179
"path": "github:jspm/nodelibs-path@0.2.0-alpha",
178180
"process": "github:jspm/nodelibs-process@0.2.0-alpha",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
"main": "app.tsx",
6464
"dependencies": {
6565
"classnames": "npm:classnames@^2.2.5",
66+
"csjs": "npm:csjs@^1.0.6",
67+
"insert-css": "npm:insert-css@^1.0.0",
6668
"react-dom": "npm:react-dom@^15.3.1",
6769
"react-redux": "npm:react-redux@^4.4.5",
6870
"react-router": "npm:react-router@^2.7.0",

src/components/component-with-local-css.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import csjs from 'csjs';
2+
import insertCss from 'insert-css';
3+
import colors from '../../themes/colors';
4+
5+
interface IStyles {
6+
container: string;
7+
well: string;
8+
glowingText: string;
9+
visibleWell: string;
10+
supriseWell: string;
11+
}
12+
13+
export const styles: IStyles = csjs`
14+
15+
.container {
16+
text-align: center;
17+
}
18+
.glowingText {
19+
color: ${colors.textColor};
20+
text-shadow: ${colors.textColor} 0 0 10px;
21+
white-space: nowrap;
22+
}
23+
.well {
24+
border-radius: 5px;
25+
border: 1px solid ${colors.borderColor};
26+
background-color: ${colors.backgroundColor};
27+
box-shadow: none;
28+
}
29+
.well:hover {
30+
box-shadow: 0 6px 20px 0 ${colors.shadowColor};
31+
}
32+
33+
.visibleWell extends .well {
34+
margin: 0px 30px;
35+
opacity: 1;
36+
transition:
37+
margin 1s 0.5s,
38+
opacity 1s 0.5s,
39+
box-shadow 0.5s linear;
40+
}
41+
42+
.supriseWell extends .well {
43+
margin: 0px 50px;
44+
opacity: 0;
45+
transition:
46+
margin 1s,
47+
opacity 1s,
48+
box-shadow 0.5s linear;
49+
}
50+
51+
@media (max-width: 450px) {
52+
.supriseWell {
53+
margin: 0px 30px;
54+
opacity: 1;
55+
transition:
56+
margin 1s 0.5s,
57+
opacity 1s 0.5s,
58+
box-shadow 0.5s linear;
59+
}
60+
.visibleWell {
61+
margin: 0px 50px;
62+
opacity: 0;
63+
transition:
64+
margin 1s,
65+
opacity 1s,
66+
box-shadow 0.5s linear;
67+
}
68+
}
69+
70+
`;
71+
72+
insertCss(csjs.getCss(styles));

src/containers/about-container/index.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
import * as React from 'react';
22
import { PageSection } from '../../components/page-section';
33
import { PageHeader } from '../../components/page-header';
4+
import { styles } from './about-styles';
5+
46

57
export function AboutContainer() {
68
return (
79
<article>
810
<PageHeader>About</PageHeader>
911
<PageSection>
10-
<p>
11-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
12-
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
13-
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
14-
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
15-
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
16-
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
17-
</p>
12+
<div className={styles.container}>
13+
<div className={styles.visibleWell}>
14+
<p className={styles.glowingText}>
15+
Shrink your window
16+
</p>
17+
</div>
18+
<div className={styles.supriseWell}>
19+
<p className={styles.glowingText}>
20+
SUPRISE!!!
21+
</p>
22+
</div>
23+
</div>
1824
</PageSection>
1925
<br />
2026
<br />

src/themes/colors.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const DARK_THEME = 'darkTheme';
2+
const selectedTheme = null;
3+
4+
export default {
5+
get textColor() {
6+
switch (selectedTheme) {
7+
case DARK_THEME: return '#111';
8+
default: return '#fff';
9+
}
10+
},
11+
borderColor: '#111111',
12+
backgroundColor: '#474747',
13+
backgroundColorLight: '#a7a7a7',
14+
shadowColor: '#000',
15+
shadowColorLight: '#888'
16+
};

0 commit comments

Comments
 (0)