Skip to content

Commit 42b5da7

Browse files
committed
added CSS Modules Example Page
1 parent db1ccf3 commit 42b5da7

File tree

7 files changed

+62
-40
lines changed

7 files changed

+62
-40
lines changed

src/app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { syncHistoryWithStore } from 'react-router-redux';
77
// app imports
88
import { MainLayout } from './layouts/main-layout';
99
import { HomeContainer } from './containers/home-container/index';
10-
import { AboutContainer } from './containers/about-container/index';
10+
import { CssModulesContainer } from './containers/css-modules-container/index';
1111
import CurrencyConverterContainer from './containers/currency-converter-container/index';
1212

1313
import { store } from './store';
@@ -19,7 +19,7 @@ function App() {
1919
<Router history={history}>
2020
<Route component={MainLayout}>
2121
<Route path="/" component={HomeContainer}/>
22-
<Route path="/about" component={AboutContainer}/>
22+
<Route path="/about" component={CssModulesContainer}/>
2323
<Route path="/currency-converter" component={CurrencyConverterContainer}/>
2424
</Route>
2525
</Router>

src/containers/about-container/index.tsx

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/containers/about-container/about-styles.tsx renamed to src/containers/css-modules-container/container-styles.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import csjs from 'csjs';
22
import insertCss from 'insert-css';
33
import colors from '../../themes/colors';
44

5-
interface AboutStyles {
5+
interface ContainerStyles {
66
/** main content container */
77
container: string;
88
textCentered: string;
@@ -18,7 +18,7 @@ interface AboutStyles {
1818
effect__showOnMobile: string;
1919
}
2020

21-
export const aboutStyles: AboutStyles = csjs`
21+
export const containerStyles: ContainerStyles = csjs`
2222
2323
.textCentered {
2424
text-align: center;
@@ -80,4 +80,4 @@ export const aboutStyles: AboutStyles = csjs`
8080
8181
`;
8282

83-
insertCss(csjs.getCss(aboutStyles));
83+
insertCss(csjs.getCss(containerStyles));
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import * as React from 'react';
2+
import { PageSection } from '../../components/page-section';
3+
import { PageHeader } from '../../components/page-header';
4+
import { containerStyles } from './container-styles';
5+
6+
7+
export function CssModulesContainer() {
8+
return (
9+
<article>
10+
<PageHeader>CSS Modules</PageHeader>
11+
<p>
12+
Own concept to achieve locally scoped CSS styles with statically typed CSS class names using TypeScript.
13+
</p>
14+
<ul>
15+
<li>
16+
Full CSS support with pseudo-classes & media queries, encapsulated in ES6 Modules that can be nicely imported by your UI components.
17+
</li>
18+
<li>Define interfaces with your CSS classes and you get className property type-checking, solid auto-completion and easy refactoring. You can also add doc comments and auto-generate docs of your styles library for your team and utilize IntelliSense features of your IDE.</li>
19+
</ul>
20+
<br />
21+
<PageSection className={containerStyles.textCentered}>
22+
<div className={containerStyles.effect__hideOnMobile}>
23+
<div className={[containerStyles.darkBg, containerStyles.effect__elevate].join(' ')}>
24+
<p className={containerStyles.glowingText}>
25+
Shrink your window
26+
</p>
27+
</div>
28+
</div>
29+
<div className={containerStyles.effect__showOnMobile}>
30+
<div className={[containerStyles.darkBg, containerStyles.effect__elevate].join(' ')}>
31+
<p className={containerStyles.glowingText}>
32+
SUPRISE!!!
33+
</p>
34+
</div>
35+
</div>
36+
</PageSection>
37+
<br />
38+
<p className="u-centered">
39+
Source code: <a href="https://github.com/piotrwitek/react-redux-typescript-starter-kit/tree/master/src/containers/css-modules-container">Link to GitHub</a>
40+
</p>
41+
<br />
42+
</article>
43+
);
44+
};

src/containers/currency-converter-container/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export class CurrencyConverterContainer extends React.Component<IProps, IState>
2323

2424
return (
2525
<section className="u-letter-box--super">
26+
<p className="u-centered">(work in progress)</p>
27+
<br />
2628
<CurrencyConverter currencies={currencies}
2729
baseCurrency={baseCurrency} targetCurrency={targetCurrency}
2830
baseValue={baseValue} targetValue={targetValue}

src/containers/home-container/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ export function HomeContainer() {
66
return (
77
<article>
88
<PageHero title="Welcome to" subtitle="React / Redux / TypeScript - starter-kit" />
9-
<PageSection>
10-
<p className="u-centered">
11-
Here you can find real world projects made using this starter-kit.
9+
<PageSection className="o-container o-container--small">
10+
<p>
11+
Below you can find a few examples created using concepts of this starter-kit:
1212
</p>
13+
<ul>
14+
<li><a href="/#/currency-converter"> Currency Converter App</a> - (work in progress)</li>
15+
<li><a href="/#/about"> CSS Modules </a></li>
16+
</ul>
17+
<div className="c-alerts__alert c-alerts__alert--primary">
18+
Note: Open Redux DevTools Inspector
19+
</div>
1320
</PageSection>
1421
<br />
1522
<br />

src/layouts/main-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class MainLayout extends React.Component<{}, {}> {
1515
<LayoutTopNav>
1616
<LayoutTopNavLink href="/" isPrimary> Home </LayoutTopNavLink>
1717
<LayoutTopNavLink href="/currency-converter"> Currency Converter </LayoutTopNavLink>
18-
<LayoutTopNavLink href="/about" isRight> About </LayoutTopNavLink>
18+
<LayoutTopNavLink href="/about"> CSS Modules </LayoutTopNavLink>
1919
</LayoutTopNav>
2020
</LayoutHeader>
2121

0 commit comments

Comments
 (0)