diff --git a/.babelrc b/.babelrc
index 38733e6..04d0ec0 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,3 +1,7 @@
{
- "presets": ["react", "es2015", "stage-0"]
+ "presets": [
+ "react",
+ "es2015",
+ "stage-0"
+ ]
}
diff --git a/README.md b/README.md
index 21ed0e0..6b28a01 100755
--- a/README.md
+++ b/README.md
@@ -8,7 +8,10 @@ Atomic React enables rapid development of web applications by using readily avai
## Reference Guides.
The components being built follow the [Component Design Guidelines](https://github.com/areai51/react-component-design)
-## Setup
+## Molecules
+Building Blocks of the repo built on the guide above.
+
+## Setup the example
Clone the Repo
`$npm i`
diff --git a/config/env.js b/example/config/env.js
similarity index 87%
rename from config/env.js
rename to example/config/env.js
index ce99b6b..fbaefb9 100755
--- a/config/env.js
+++ b/example/config/env.js
@@ -1,10 +1,10 @@
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in Webpack configuration.
-var REACT_APP = /^REACT_APP_/i;
+const REACT_APP = /^REACT_APP_/i;
function getClientEnvironment(publicUrl) {
- var raw = Object
+ const raw = Object
.keys(process.env)
.filter(key => REACT_APP.test(key))
.reduce((env, key) => {
@@ -13,15 +13,15 @@ function getClientEnvironment(publicUrl) {
}, {
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
- 'NODE_ENV': process.env.NODE_ENV || 'development',
+ NODE_ENV: process.env.NODE_ENV || 'development',
// Useful for resolving the correct path to static assets in `public`.
// For example, .
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
- 'PUBLIC_URL': publicUrl
+ PUBLIC_URL: publicUrl
});
// Stringify all values so we can feed into Webpack DefinePlugin
- var stringified = {
+ const stringified = {
'process.env': Object
.keys(raw)
.reduce((env, key) => {
diff --git a/config/jest/cssTransform.js b/example/config/jest/cssTransform.js
similarity index 100%
rename from config/jest/cssTransform.js
rename to example/config/jest/cssTransform.js
diff --git a/config/jest/fileTransform.js b/example/config/jest/fileTransform.js
similarity index 100%
rename from config/jest/fileTransform.js
rename to example/config/jest/fileTransform.js
diff --git a/config/paths.js b/example/config/paths.js
similarity index 75%
rename from config/paths.js
rename to example/config/paths.js
index 97417b9..58b6360 100755
--- a/config/paths.js
+++ b/example/config/paths.js
@@ -1,10 +1,17 @@
-var path = require('path');
-var fs = require('fs');
-var url = require('url');
+import path from 'path';
+import fs from 'fs';
+import url from 'url';
+const envPublicUrl = process.env.PUBLIC_URL;
+const nodePaths = (process.env.NODE_PATH || '')
+ .split(process.platform === 'win32' ? ';' : ':')
+ .filter(Boolean)
+ .filter(folder => !path.isAbsolute(folder))
+ .map(resolveApp);
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
-var appDirectory = fs.realpathSync(process.cwd());
+const appDirectory = fs.realpathSync(process.cwd());
+
function resolveApp(relativePath) {
return path.resolve(appDirectory, relativePath);
}
@@ -24,20 +31,12 @@ function resolveApp(relativePath) {
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
-var nodePaths = (process.env.NODE_PATH || '')
- .split(process.platform === 'win32' ? ';' : ':')
- .filter(Boolean)
- .filter(folder => !path.isAbsolute(folder))
- .map(resolveApp);
-
-var envPublicUrl = process.env.PUBLIC_URL;
-
function ensureSlash(path, needsSlash) {
- var hasSlash = path.endsWith('/');
+ const hasSlash = path.endsWith('/');
if (hasSlash && !needsSlash) {
return path.substr(path, path.length - 1);
} else if (!hasSlash && needsSlash) {
- return path + '/';
+ return `${path}/`;
} else {
return path;
}
@@ -54,26 +53,27 @@ function getPublicUrl(appPackageJson) {
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
function getServedPath(appPackageJson) {
- var publicUrl = getPublicUrl(appPackageJson);
- var servedUrl = envPublicUrl || (
- publicUrl ? url.parse(publicUrl).pathname : '/'
- );
+ const publicUrl = getPublicUrl(appPackageJson);
+ const servedUrl = envPublicUrl || (
+ publicUrl ? url.parse(publicUrl).pathname : '/'
+ );
return ensureSlash(servedUrl, true);
}
// config after eject: we're in ./config/
-module.exports = {
+export default {
appBuild: resolveApp('build'),
- appPublic: resolveApp('public'),
- appHtml: resolveApp('public/index.html'),
- appIndexJs: resolveApp('src/index.js'),
+ appPublic: resolveApp('example/public'),
+ appHtml: resolveApp('example/public/index.html'),
+ appIndexJs: resolveApp('example/src/index.js'),
appPackageJson: resolveApp('package.json'),
- appSrc: resolveApp('src'),
+ appSrc: resolveApp('example/src'),
+ moleculeSrc: resolveApp('molecules'),
yarnLockFile: resolveApp('yarn.lock'),
- testsSetup: resolveApp('src/setupTests.js'),
+ testsSetup: resolveApp('example/src/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
ownNodeModules: resolveApp('node_modules'),
- nodePaths: nodePaths,
+ nodePaths,
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json'))
};
diff --git a/config/polyfills.js b/example/config/polyfills.js
similarity index 100%
rename from config/polyfills.js
rename to example/config/polyfills.js
diff --git a/config/webpack.config.dev.js b/example/config/webpack.config.dev.js
similarity index 86%
rename from config/webpack.config.dev.js
rename to example/config/webpack.config.dev.js
index fa625e7..406f886 100755
--- a/config/webpack.config.dev.js
+++ b/example/config/webpack.config.dev.js
@@ -1,28 +1,26 @@
-var autoprefixer = require('autoprefixer');
-var webpack = require('webpack');
-var HtmlWebpackPlugin = require('html-webpack-plugin');
-var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
-var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
-var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
-var getClientEnvironment = require('./env');
-var paths = require('./paths');
-
-
+import autoprefixer from 'autoprefixer';
+import webpack from 'webpack';
+import HtmlWebpackPlugin from 'html-webpack-plugin';
+import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
+import InterpolateHtmlPlugin from 'react-dev-utils/InterpolateHtmlPlugin';
+import WatchMissingNodeModulesPlugin from 'react-dev-utils/WatchMissingNodeModulesPlugin';
+import getClientEnvironment from './env';
+import paths from './paths';
// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
-var publicPath = '/';
+const publicPath = '/';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
-var publicUrl = '';
+const publicUrl = '';
// Get environment variables to inject into our app.
-var env = getClientEnvironment(publicUrl);
+const env = getClientEnvironment(publicUrl);
// This is the development configuration.
// It is focused on developer experience and fast rebuilds.
// The production configuration is different and lives in a separate file.
-module.exports = {
+export default {
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.
devtool: 'cheap-module-source-map',
@@ -79,17 +77,17 @@ module.exports = {
'react-native': 'react-native-web'
}
},
-
+
module: {
// First, run the linter.
// It's important to do this before Babel processes the JS.
- /*preLoaders: [
- {
- test: /\.(js|jsx)$/,
- loader: 'eslint',
- include: paths.appSrc,
- }
- ],*/
+ /* preLoaders: [
+ {
+ test: /\.(js|jsx)$/,
+ loader: 'eslint',
+ include: paths.appSrc,
+ }
+ ],*/
loaders: [
// ** ADDING/UPDATING LOADERS **
// The "url" loader handles all assets unless explicitly excluded.
@@ -116,10 +114,10 @@ module.exports = {
// Process JS with Babel.
{
test: /\.(js|jsx)$/,
- include: paths.appSrc,
+ include: [paths.appSrc, paths.moleculeSrc],
loader: 'babel',
query: {
-
+
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
@@ -135,8 +133,8 @@ module.exports = {
test: /\.css$/,
loader: 'style!css?importLoaders=1!postcss'
- //------ Using CSS Modules-----//
- // loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss'
+ // ------ Using CSS Modules-----//
+ // loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss'
},
// JSON is not enabled by default in Webpack but both Node and Browserify
// allow it implicitly so we also enable it.
@@ -156,20 +154,18 @@ module.exports = {
// Remember to add the new extension(s) to the "url" loader exclusion list.
]
},
-
+
// We use PostCSS for autoprefixing only.
- postcss: function() {
- return [
- autoprefixer({
- browsers: [
- '>1%',
- 'last 4 versions',
- 'Firefox ESR',
- 'not ie < 9', // React doesn't support IE8 anyway
- ]
- }),
- ];
- },
+ postcss: () => [
+ autoprefixer({
+ browsers: [
+ '>1%',
+ 'last 4 versions',
+ 'Firefox ESR',
+ 'not ie < 9', // React doesn't support IE8 anyway
+ ]
+ }),
+ ],
plugins: [
// Makes some environment variables available in index.html.
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
diff --git a/config/webpack.config.prod.js b/example/config/webpack.config.prod.js
similarity index 92%
rename from config/webpack.config.prod.js
rename to example/config/webpack.config.prod.js
index c5c14c9..7511a32 100755
--- a/config/webpack.config.prod.js
+++ b/example/config/webpack.config.prod.js
@@ -1,27 +1,24 @@
-var autoprefixer = require('autoprefixer');
-var webpack = require('webpack');
-var HtmlWebpackPlugin = require('html-webpack-plugin');
-var ExtractTextPlugin = require('extract-text-webpack-plugin');
-var ManifestPlugin = require('webpack-manifest-plugin');
-var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
-var url = require('url');
-var paths = require('./paths');
-var getClientEnvironment = require('./env');
-
-
+import autoprefixer from 'autoprefixer';
+import webpack from 'webpack';
+import HtmlWebpackPlugin from 'html-webpack-plugin';
+import ExtractTextPlugin from 'extract-text-webpack-plugin';
+import ManifestPlugin from 'webpack-manifest-plugin';
+import InterpolateHtmlPlugin from 'react-dev-utils/InterpolateHtmlPlugin';
+import paths from './paths';
+import getClientEnvironment from './env';
// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
-var publicPath = paths.servedPath;
+const publicPath = paths.servedPath;
// Some apps do not use client-side routing with pushState.
// For these, "homepage" can be set to "." to enable relative asset paths.
-var shouldUseRelativeAssetPaths = publicPath === './';
+const shouldUseRelativeAssetPaths = publicPath === './';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
-var publicUrl = publicPath.slice(0, -1);
+const publicUrl = publicPath.slice(0, -1);
// Get environment variables to inject into our app.
-var env = getClientEnvironment(publicUrl);
+const env = getClientEnvironment(publicUrl);
// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
@@ -44,7 +41,7 @@ const extractTextPluginOptions = shouldUseRelativeAssetPaths
// This is the production configuration.
// It compiles slowly and is focused on producing a fast and minimal bundle.
// The development configuration is different and lives in a separate file.
-module.exports = {
+export default {
// Don't attempt to continue if there are any errors.
bail: true,
// We generate sourcemaps in production. This is slow but gives good results.
@@ -64,7 +61,7 @@ module.exports = {
filename: 'static/js/[name].[chunkhash:8].js',
chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
// We inferred the "public path" (such as / or /my-project) from homepage.
- publicPath: publicPath
+ publicPath
},
resolve: {
// This allows you to set a fallback for where Webpack should look for modules.
@@ -84,7 +81,7 @@ module.exports = {
'react-native': 'react-native-web'
}
},
-
+
module: {
// First, run the linter.
// It's important to do this before Babel processes the JS.
@@ -121,9 +118,9 @@ module.exports = {
// Process JS with Babel.
{
test: /\.(js|jsx)$/,
- include: paths.appSrc,
+ include: [paths.appSrc, paths.moleculeSrc],
loader: 'babel',
-
+
},
// The notation here is somewhat confusing.
// "postcss" loader applies autoprefixer to our CSS.
@@ -164,9 +161,9 @@ module.exports = {
// Remember to add the new extension(s) to the "url" loader exclusion list.
]
},
-
+
// We use PostCSS for autoprefixing only.
- postcss: function() {
+ postcss() {
return [
autoprefixer({
browsers: [
diff --git a/example/public/data/catalog.json b/example/public/data/catalog.json
new file mode 100755
index 0000000..c8f4294
--- /dev/null
+++ b/example/public/data/catalog.json
@@ -0,0 +1,19 @@
+{
+ "data": [
+ {
+ "image": "http://placehold.it/256x192/",
+ "heading": "Men's Jeans",
+ "text": "An index card consists of card stock cut to a standard size, used for recording and storing small amounts of discrete data. It was invented by Carl Linnaeus, around 1760."
+ },
+ {
+ "image": "http://placehold.it/256x192/",
+ "heading": "Men's Formal Pants",
+ "text": "An index card consists of card stock cut to a standard size, used for recording and storing small amounts of discrete data. It was invented by Carl Linnaeus, around 1760."
+ },
+ {
+ "image": "http://placehold.it/256x192/",
+ "heading": "Men's Formal Pants",
+ "text": "An index card consists of card stock cut to a standard size, used for recording and storing small amounts of discrete data. It was invented by Carl Linnaeus, around 1760."
+ }
+ ]
+}
\ No newline at end of file
diff --git a/example/public/data/config.json b/example/public/data/config.json
new file mode 100644
index 0000000..de1bcae
--- /dev/null
+++ b/example/public/data/config.json
@@ -0,0 +1,22 @@
+{
+ "brandName": "Atomic React",
+ "theme": "light",
+ "defaultLogo": "https://image.ibb.co/fNJGbF/atomic_react_logo_invert.png",
+ "nav": [
+ {
+ "title": "Home",
+ "url": "https://github.com/pagesource/atomic-react",
+ "index": "1"
+ },
+ {
+ "title": "Guidelines",
+ "url": "https://github.com/areai51/react-component-design",
+ "index": "2"
+ },
+ {
+ "title": "Random Bash",
+ "url": "http://bash.org/?random",
+ "index": "3"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/example/public/data/news.json b/example/public/data/news.json
new file mode 100755
index 0000000..ff47876
--- /dev/null
+++ b/example/public/data/news.json
@@ -0,0 +1,28 @@
+[
+ {
+ "title": "Angular 4 beta is out",
+ "imgUrl": "img.jpg",
+ "description": "this is the full description ",
+ "date": "23 Feb 2017",
+ "author": "@areai51"
+ },
+ {
+ "title": "React Fiber coming soon",
+ "imgUrl": "img.jpg",
+ "description": "React figbre brings a lot of new improvements ",
+ "date": "21 Feb 2017",
+ "author": "@john"
+ },
+ {
+ "title": "Angular 4 beta is out",
+ "imgUrl": "img.jpg",
+ "description": "this is the full description ",
+ "date": "1 Jan 2017",
+ "author": "@peter"
+ },
+ {
+ "title": "Angular 4 beta is out",
+ "imgUrl": "img.jpg",
+ "description": "this is the full description "
+ }
+]
\ No newline at end of file
diff --git a/public/favicon.ico b/example/public/favicon.ico
similarity index 100%
rename from public/favicon.ico
rename to example/public/favicon.ico
diff --git a/src/img/atomic-react-logo-invert.png b/example/public/img/atomic-react-logo-invert.png
similarity index 100%
rename from src/img/atomic-react-logo-invert.png
rename to example/public/img/atomic-react-logo-invert.png
diff --git a/src/img/atomic-react-logo.png b/example/public/img/atomic-react-logo.png
similarity index 100%
rename from src/img/atomic-react-logo.png
rename to example/public/img/atomic-react-logo.png
diff --git a/src/img/tiger.jpg b/example/public/img/tiger.jpg
similarity index 100%
rename from src/img/tiger.jpg
rename to example/public/img/tiger.jpg
diff --git a/src/styles/dark-theme.css b/example/public/styles/dark-theme.css
similarity index 100%
rename from src/styles/dark-theme.css
rename to example/public/styles/dark-theme.css
diff --git a/src/styles/index.css b/example/public/styles/index.css
similarity index 100%
rename from src/styles/index.css
rename to example/public/styles/index.css
diff --git a/src/styles/light-theme.css b/example/public/styles/light-theme.css
similarity index 100%
rename from src/styles/light-theme.css
rename to example/public/styles/light-theme.css
diff --git a/example/src/App.css b/example/src/App.css
new file mode 100755
index 0000000..57dbc3f
--- /dev/null
+++ b/example/src/App.css
@@ -0,0 +1,18 @@
+@import '../public/styles/light-theme.css';
+@import '../public/styles/dark-theme.css';
+
+.app {
+ width: 95%;
+ margin: 0 auto;
+}
+
+@keyframes app-logo-spin {
+ from {
+ transform: rotate(0deg);
+ }
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+
diff --git a/example/src/App.js b/example/src/App.js
new file mode 100755
index 0000000..5601d72
--- /dev/null
+++ b/example/src/App.js
@@ -0,0 +1,69 @@
+import React from 'react';
+import { CardContainer, Footer, Header } from './organisms/index';
+import { Grid, Hero, Navigation, Panel, Tout } from '../../molecules';
+import classnames from 'classnames';
+
+import './App.css';
+import config from '../public/data/config.json';
+
+export const App = () => {
+ const theme = config.theme;
+
+ return (
+
+
+
+
+
+
+
+
Cards
+
+
+
Panel
+
+
+
+
+
Sir Joseph John Thomson (18 December 1856 – 30 August 1940) was an English physicist and Nobel laureate
+ in physics, credited with the discovery and identification of the electron; and with the discovery of the
+ first subatomic particle. He was elected as a fellow of the Royal Society of London and appointed to the
+ Cavendish Professorship of Experimental Physics at the Cambridge University's Cavendish Laboratory in
+ 1884. In 1897, Thomson showed that cathode rays were composed of previously unknown negatively charged
+ particles, which he calculated must have bodies much smaller than atoms and a very large value for their
+ charge-to-mass ratio.[3] Thomson is also credited with finding the first evidence for isotopes of a stable
+ (non-radioactive) element in 1913, as part of his exploration into the composition of canal rays (positive
+ ions). His experiments to determine the nature of positively charged particles, with Francis William
+ Aston, were the first use of mass spectrometry and led to the development of the mass spectrograph.
+ Thomson was awarded the 1906 Nobel Prize in Physics for his work on the conduction of electricity in
+ gases. Seven of his students, including his son George Paget Thomson, also became Nobel Prize winners
+ either in physics or in chemistry. His record is comparable only to that of the German physicist Arnold
+ Sommerfeld.
+
+
+
+
+
);
+};
diff --git a/src/App.test.js b/example/src/App.test.js
similarity index 100%
rename from src/App.test.js
rename to example/src/App.test.js
diff --git a/example/src/actions/cardContainer-actions.js b/example/src/actions/cardContainer-actions.js
new file mode 100755
index 0000000..d4318f5
--- /dev/null
+++ b/example/src/actions/cardContainer-actions.js
@@ -0,0 +1,34 @@
+import { cardSuccess } from '../constants/action-types';
+import catalogDetails from '../../public/data/catalog.json';
+
+/* To fetch data from an API call*/
+// import { fetchCatelogDetailsData } from './../utils/helper';
+
+/* To fetch data from an API call*/
+/* export const fetchCatelogCards = () => {
+ return function(dispatch){
+ fetchCatelogDetailsData()
+ .then(function (response) {
+ console.log(response);
+ // Dispatch the success action with the payload
+ dispatch({
+ type: cardSuccess,
+ payload: response.data,
+ });
+ }.bind(this))
+ .catch(function (error) {
+ // Dispatch the error action with error information
+ dispatch({
+ type: Card_FAIL,
+ error: error
+ });
+ });
+ };
+ }*/
+
+export const fetchCatalogCards = () => {
+ return {
+ type: cardSuccess,
+ payload: catalogDetails
+ };
+};
diff --git a/src/constants/action-types.js b/example/src/constants/action-types.js
similarity index 100%
rename from src/constants/action-types.js
rename to example/src/constants/action-types.js
diff --git a/src/containers/card-container.js b/example/src/containers/card-container.js
similarity index 53%
rename from src/containers/card-container.js
rename to example/src/containers/card-container.js
index a87c1fa..89bf658 100755
--- a/src/containers/card-container.js
+++ b/example/src/containers/card-container.js
@@ -1,18 +1,18 @@
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
-import { fetchCatelogCards } from './../actions/cardContainer-actions';
+import { fetchCatalogCards } from '../actions/cardContainer-actions';
-import CardContainer from './../organisms/CardContainer';
+import CardContainer from '../organisms/CardContainer';
-const mapStateToProps = (state) => {
+const mapStateToProps = ({ CardContainerPage }) => {
return {
- cardData: state.CardContinerPage.cardData
+ cardData: CardContainerPage.cardData
};
};
const mapDispatchToProps = (dispatch) => {
return bindActionCreators({
- fetchCatelogCards
+ fetchCatalogCards
}, dispatch);
};
diff --git a/src/index.js b/example/src/index.js
similarity index 64%
rename from src/index.js
rename to example/src/index.js
index 6cdbd40..97fdc5b 100755
--- a/src/index.js
+++ b/example/src/index.js
@@ -2,15 +2,13 @@ import React from 'react';
import { render } from 'react-dom';
import configureStore from './store/configureStore';
import { Provider } from 'react-redux';
-// import App from './App';
-
-import App from './App';
-import './styles/index.css';
+import { App } from './App';
+import '../public/styles/index.css';
const store = configureStore();
render(
- , document.getElementById('root')
+ , document.getElementById('atomicExample')
);
diff --git a/src/organisms/CardContainer.css b/example/src/organisms/CardContainer.css
similarity index 100%
rename from src/organisms/CardContainer.css
rename to example/src/organisms/CardContainer.css
diff --git a/src/organisms/CardContainer.jsx b/example/src/organisms/CardContainer.jsx
similarity index 84%
rename from src/organisms/CardContainer.jsx
rename to example/src/organisms/CardContainer.jsx
index 6dfcb46..0dfb869 100755
--- a/src/organisms/CardContainer.jsx
+++ b/example/src/organisms/CardContainer.jsx
@@ -1,16 +1,15 @@
import React, { Component, PropTypes } from 'react';
-import { Card } from '../molecules';
+import { Card } from '../../../molecules/index';
/* import styles from './CardContainer.css'; */
// const cards = Array.from({ length: 3 }, (c) => card)
// const primary = /^\#/.test(colors.primary) ? colors.primary.replace('#', '') : '#666'
// const primary = '#ff6600';
-
class CardContainer extends Component {
componentWillMount() {
- this.props.fetchCatelogCards();
+ this.props.fetchCatalogCards();
}
render() {
@@ -28,15 +27,15 @@ class CardContainer extends Component {
CardContainer.propTypes = {
/**
* Card Data as Object
- */
+ */
cardData: PropTypes.object,
/**
* Function called to get data
- */
- fetchCatelogCards: PropTypes.func,
+ */
+ fetchCatalogCards: PropTypes.func,
/**
- * Theme
- */
+ * Theme
+ */
theme: PropTypes.oneOf(['light', 'dark'])
};
diff --git a/example/src/organisms/Footer.css b/example/src/organisms/Footer.css
new file mode 100755
index 0000000..6e30abd
--- /dev/null
+++ b/example/src/organisms/Footer.css
@@ -0,0 +1,10 @@
+.footer {
+ background: #ccc;
+ padding: 1.5rem;
+ margin-top: 2rem;
+ border-top: thin solid #333;
+}
+
+.links {
+ padding: 10px;
+}
\ No newline at end of file
diff --git a/src/organisms/Footer.jsx b/example/src/organisms/Footer.jsx
similarity index 92%
rename from src/organisms/Footer.jsx
rename to example/src/organisms/Footer.jsx
index 1ca182c..3554039 100755
--- a/src/organisms/Footer.jsx
+++ b/example/src/organisms/Footer.jsx
@@ -2,7 +2,7 @@ import React, { PropTypes } from 'react';
import './Footer.css';
import classnames from 'classnames';
-const Footer = ({ ...props }) => {
+const Footer = (props) => {
const { currentYear, links, theme } = props;
return (
@@ -21,15 +21,15 @@ const Footer = ({ ...props }) => {
Footer.propTypes = {
/**
* Links Array
- */
+ */
links: PropTypes.arrayOf(PropTypes.shape({})),
/**
* Current Year
- */
+ */
currentYear: PropTypes.number,
/**
- * Theme
- */
+ * Theme
+ */
theme: PropTypes.oneOf(['light', 'dark'])
};
diff --git a/src/organisms/Header.css b/example/src/organisms/Header.css
similarity index 80%
rename from src/organisms/Header.css
rename to example/src/organisms/Header.css
index 7b4ee20..6665615 100755
--- a/src/organisms/Header.css
+++ b/example/src/organisms/Header.css
@@ -1,7 +1,7 @@
-.header{
+.header {
background: #263238;
padding: 0.5rem;
- min-height:5rem;
+ min-height: 5rem;
}
.branding {
diff --git a/src/organisms/Header.jsx b/example/src/organisms/Header.jsx
similarity index 76%
rename from src/organisms/Header.jsx
rename to example/src/organisms/Header.jsx
index 71fae3a..f211b9a 100755
--- a/src/organisms/Header.jsx
+++ b/example/src/organisms/Header.jsx
@@ -1,6 +1,6 @@
import React, { PropTypes } from 'react';
-import { Avatar, Logo } from '../molecules';
+import { Avatar, Logo } from '../../../molecules/index';
import './Header.css';
import classnames from 'classnames';
@@ -8,7 +8,7 @@ const Header = (props) => {
const { theme } = props;
return (
-
+ {
/>
Atomic React
-
+
);
};
@@ -31,9 +31,10 @@ Header.defaultProps = {
Header.propTypes = {
/**
- * Theme
- */
- theme: PropTypes.oneOf(['light', 'dark'])
+ * Theme
+ */
+ theme: PropTypes.oneOf(['light', 'dark']),
+ class: PropTypes.string
};
export default Header;
diff --git a/src/organisms/index.js b/example/src/organisms/index.js
similarity index 55%
rename from src/organisms/index.js
rename to example/src/organisms/index.js
index 88dd7f0..a9c2e35 100755
--- a/src/organisms/index.js
+++ b/example/src/organisms/index.js
@@ -1,5 +1,4 @@
-
export { default as Header } from './Header';
export { default as Footer } from './Footer';
-export { default as CardContainer } from './../containers/card-container';
+export { default as CardContainer } from '../containers/card-container';
diff --git a/src/reducers/CardContainer-reducer.js b/example/src/reducers/CardContainer-reducer.js
similarity index 100%
rename from src/reducers/CardContainer-reducer.js
rename to example/src/reducers/CardContainer-reducer.js
diff --git a/src/reducers/index.js b/example/src/reducers/index.js
similarity index 80%
rename from src/reducers/index.js
rename to example/src/reducers/index.js
index 25e5e0d..6078ee1 100755
--- a/src/reducers/index.js
+++ b/example/src/reducers/index.js
@@ -1,7 +1,7 @@
import { combineReducers } from 'redux';
import CardContainerReducer from './CardContainer-reducer';
const rootReducer = combineReducers({
- CardContinerPage: CardContainerReducer
+ CardContainerPage: CardContainerReducer
});
export default rootReducer;
diff --git a/src/store/configureStore.js b/example/src/store/configureStore.js
similarity index 65%
rename from src/store/configureStore.js
rename to example/src/store/configureStore.js
index c557a44..147cc22 100755
--- a/src/store/configureStore.js
+++ b/example/src/store/configureStore.js
@@ -1,5 +1,5 @@
-import { createStore, applyMiddleware, compose } from 'redux';
-import rootReducer from '../reducers';
+import { applyMiddleware, compose, createStore } from 'redux';
+import rootReducer from '../reducers/index';
import thunk from 'redux-thunk';
export default function configureStore(initialState) {
diff --git a/example/src/utils/helper.js b/example/src/utils/helper.js
new file mode 100755
index 0000000..af5bf65
--- /dev/null
+++ b/example/src/utils/helper.js
@@ -0,0 +1,18 @@
+const axios = require('axios');
+
+export const getData = (url) => {
+ return axios.get(url)
+ .then(function(response) {
+ return response;
+ })
+ .catch(function(error) {
+ return error;
+ });
+};
+
+/* To fetch data from an API call
+ export const fetchCatalogDetailsData = () => {
+ const url = 'https://jsonplaceholder.typicode.com/users';
+ return getData(url);
+ };
+ */
\ No newline at end of file
diff --git a/molecules/Avatar.css b/molecules/Avatar.css
new file mode 100755
index 0000000..e1b40bb
--- /dev/null
+++ b/molecules/Avatar.css
@@ -0,0 +1,5 @@
+.avatar {
+ border-radius: 50%;
+ background: #ccc;
+ float: right;
+}
\ No newline at end of file
diff --git a/src/molecules/Avatar.jsx b/molecules/Avatar.jsx
similarity index 77%
rename from src/molecules/Avatar.jsx
rename to molecules/Avatar.jsx
index deb6b4f..62d4e05 100755
--- a/src/molecules/Avatar.jsx
+++ b/molecules/Avatar.jsx
@@ -1,8 +1,8 @@
import React, { PropTypes } from 'react';
-
+// Import of Styles could be as simple as importing the file like given below.
import './Avatar.css';
-const Avatar = ({ ...props }) => {
+const Avatar = (props) => {
return (
{
Avatar.propTypes = {
/**
* Picture URL
- */
+ */
picUrl: PropTypes.string,
/**
* Alt Tag
- */
+ */
altTag: PropTypes.string,
/**
* Image Size
- */
+ */
size: PropTypes.number
};
diff --git a/src/molecules/Button.css b/molecules/Button.css
similarity index 50%
rename from src/molecules/Button.css
rename to molecules/Button.css
index 1a54bf2..602c9d1 100755
--- a/src/molecules/Button.css
+++ b/molecules/Button.css
@@ -1,6 +1,6 @@
-.primary{
- background:#ccc;
- padding:0.5rem 1rem;
+.primary {
+ background: #ccc;
+ padding: 0.5rem 1rem;
font-size: 1rem;
border: none;
cursor: pointer;
diff --git a/src/molecules/Button.jsx b/molecules/Button.jsx
similarity index 97%
rename from src/molecules/Button.jsx
rename to molecules/Button.jsx
index 6ab9b22..e91fa0d 100755
--- a/src/molecules/Button.jsx
+++ b/molecules/Button.jsx
@@ -1,7 +1,6 @@
import React, { PropTypes } from 'react';
import './Button.css';
-
const Button = (props) => {
return (
@@ -19,11 +18,11 @@ const Button = (props) => {
Button.propTypes = {
/**
* onClick Function
- */
+ */
onClick: PropTypes.func,
/**
* Children
- */
+ */
children: PropTypes.string
};
export default Button;
diff --git a/molecules/Card.css b/molecules/Card.css
new file mode 100755
index 0000000..e4051a0
--- /dev/null
+++ b/molecules/Card.css
@@ -0,0 +1,12 @@
+.cardContainer {
+ display: flex;
+ width: 100%;
+}
+
+.card {
+ text-align: center;
+ flex: 1;
+ background: #fff;
+ padding: 1rem;
+ margin: 1rem;
+}
\ No newline at end of file
diff --git a/src/molecules/Card.jsx b/molecules/Card.jsx
similarity index 90%
rename from src/molecules/Card.jsx
rename to molecules/Card.jsx
index ca22315..5c031e5 100755
--- a/src/molecules/Card.jsx
+++ b/molecules/Card.jsx
@@ -1,4 +1,3 @@
-
import React, { PropTypes } from 'react';
import classnames from 'classnames';
@@ -14,8 +13,8 @@ const Card = (props) => {
{cardDetails && cardDetails.map((card, index) =>