Skip to content

Commit e36f91b

Browse files
author
Ankith Konda
committed
Updated to React 16 and implimented styled-components
1 parent 6719935 commit e36f91b

File tree

8 files changed

+8676
-108
lines changed

8 files changed

+8676
-108
lines changed

package-lock.json

Lines changed: 8634 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -27,66 +27,40 @@
2727
"autoprefixer-loader": "^3.2.0",
2828
"babel-cli": "^6.24.0",
2929
"babel-core": "^6.24.0",
30-
"babel-loader": "^6.4.0",
31-
"babel-preset-latest": "^6.24.0",
30+
"babel-loader": "^7.1.2",
31+
"babel-plugin-add-module-exports": "^0.2.1",
32+
"babel-plugin-react-html-attrs": "^2.0.0",
33+
"babel-plugin-transform-class-properties": "^6.23.0",
34+
"babel-plugin-transform-decorators-legacy": "^1.3.4",
35+
"babel-preset-env": "^1.6.0",
3236
"babel-preset-react": "^6.23.0",
3337
"babel-preset-stage-0": "^6.22.0",
3438
"browser-sync": "^2.18.8",
3539
"browser-sync-webpack-plugin": "^1.1.4",
36-
"css-loader": "^0.27.3",
37-
"extract-text-webpack-plugin": "^2.1.0",
38-
"file-loader": "^0.10.1",
40+
"css-loader": "^0.28.7",
41+
"extract-text-webpack-plugin": "^3.0.1",
42+
"file-loader": "^1.1.5",
3943
"json-loader": "^0.5.4",
4044
"node-sass": "^4.5.0",
4145
"path": "^0.12.7",
4246
"sass-loader": "^6.0.3",
4347
"strip-loader": "^0.1.2",
44-
"style-loader": "^0.13.2",
45-
"url-loader": "^0.5.8",
46-
"webpack": "^2.2.1",
48+
"style-loader": "^0.19.0",
49+
"url-loader": "^0.6.2",
50+
"webpack": "^3.6.0",
4751
"webpack-bundle-analyzer": "^2.3.1"
4852
},
4953
"dependencies": {
50-
"axios": "^0.15.3",
51-
"babel-core": "^6.24.0",
52-
"babel-loader": "^6.4.0",
53-
"babel-plugin-add-module-exports": "^0.2.1",
54-
"babel-plugin-react-html-attrs": "^2.0.0",
55-
"babel-plugin-transform-class-properties": "^6.23.0",
56-
"babel-plugin-transform-decorators-legacy": "^1.3.4",
54+
"axios": "^0.16.2",
5755
"bootstrap": "^3.3.7",
58-
"font-awesome": "^4.7.0",
59-
"font-awesome-webpack": "0.0.5-beta.2",
60-
"fs": "0.0.1-security",
61-
"jquery": "^3.1.1",
62-
"js-marker-clusterer": "^1.0.0",
63-
"jspdf": "^1.3.3",
64-
"less": "^2.7.2",
6556
"lodash": "^4.17.4",
66-
"marker-clusterer-plus": "^2.1.4",
67-
"pdfmake": "^0.1.27",
68-
"prop-types": "~15.5.4",
69-
"rc-slider": "^8.1.3",
70-
"react": "^15.4.2",
71-
"react-bootstrap": "^0.30.8",
72-
"react-bootstrap-slider": "^2.0.0",
73-
"react-checkbox-group": "^3.1.1",
74-
"react-datepicker": "^0.47.0",
75-
"react-dom": "^15.4.2",
76-
"react-dropdown": "^1.2.1",
77-
"react-dropzone": "^3.12.2",
78-
"react-fa": "^4.1.2",
79-
"react-fontawesome": "^1.5.0",
80-
"react-google-autocomplete": "^1.0.12",
81-
"react-photo-gallery": "^5.6.1",
82-
"react-redux": "^5.0.3",
83-
"react-select": "^1.0.0-rc.3",
84-
"react-tagcloud": "^1.2.0",
85-
"redux": "^3.6.0",
86-
"redux-logger": "^2.8.2",
87-
"redux-promise-middleware": "^4.2.0",
88-
"redux-thunk": "^2.2.0",
57+
"polished": "^1.8.0",
58+
"prop-types": "~15.6.0",
59+
"react": "^16.0.0",
60+
"react-dom": "^16.0.0",
61+
"react-fa": "^5.0.0",
62+
"styled-components": "^2.2.1",
8963
"uuid": "^3.0.1"
9064
},
91-
"private":true
65+
"private": true
9266
}

src/components/Container.js renamed to src/Components/App.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
import '../stylesheets/Container.scss'
2-
31
import React from "react"
4-
52
import axios from "axios"
3+
import styled from "styled-components"
4+
5+
6+
// See styled-components documentation for further api info
7+
const Container = styled.div`
68
9+
background-color:green;
710
8-
export default class Container extends React.Component {
11+
`
912

13+
const Heading = styled.h1`
14+
color:red;
15+
`
1016

17+
export default class App extends React.Component {
1118
constructor(props){
1219
super(props);
1320

@@ -58,26 +65,25 @@ export default class Container extends React.Component {
5865
render(){
5966

6067
let LTI_Message = "Oh No LTI is not valid"
61-
if($LTI_custom_variable_by_user_bool && $LTI_is_valid){
62-
LTI_Message = <span className="valid-lti-span">{"LTI is valid and a custom LTI varible is now available in the gloabal scope - "+$LTI_custom_variable_by_user_string}</span>;
68+
if($LTI_is_valid){
69+
LTI_Message = <span>{"LTI is valid and a custom LTI varible is now available in the gloabal scope - "+$LTI_custom_variable_by_user_string}</span>;
6370
}
6471

6572

6673
return (
67-
<div className="container-component clearfix">
68-
<h1>{this.state.input_val}</h1>
74+
<Container>
75+
<Heading>{this.state.input_val}</Heading>
6976

7077
<input
7178
type="text"
72-
class="form-input"
7379
id="usr"
7480
value={this.state.input_val}
7581
onChange={this.handleInputOnChange}
7682
/>
77-
<h2>{this.state.api_message}</h2>
83+
<h2 className="test">{this.state.api_message}</h2>
7884
<h3>{LTI_Message}</h3>
7985

8086

81-
</div>);
87+
</Container>);
8288
}
8389
}

src/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import 'bootstrap/dist/css/bootstrap.css'
2-
31
import React from "react"
42
import ReactDOM from "react-dom"
53

6-
import Container from "./components/Container"
4+
import App from "./Components/App"
75

8-
const app = document.getElementById('app');
6+
const appContainer = document.getElementById('app');
97
let state = {
108
input_val:"Welcome to React App with PHP API",
119
api_message:"",
1210
}
13-
ReactDOM.render(<Container appState={state}/>, app);
11+
ReactDOM.render(<App appState={state}/>, appContainer);
1412

1513

src/stylesheets/Container.scss

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

src/stylesheets/_constants.scss

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

src/stylesheets/_mixins.scss

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

webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module.exports = {
4444
exclude: /(node_modules)/,
4545
loader: "babel-loader",
4646
query: {
47-
presets: ["latest", "stage-0", "react"],
47+
presets: ["env", "stage-0", "react"],
4848
plugins: ["react-html-attrs", "transform-class-properties", "transform-decorators-legacy"]
4949
}
5050
},
@@ -56,7 +56,7 @@ module.exports = {
5656
{
5757
test: /\.scss$/,
5858
exclude: /(node_modules)/,
59-
loader:"style-loader!css-loader!autoprefixer-loader!sass-loader"
59+
loader:"style-loader!css-loader!sass-loader"
6060
},
6161
{
6262
test: /\.css$/,

0 commit comments

Comments
 (0)