forked from urgn-zz/react-weather
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yurii Raichynets PL
authored and
Yurii Raichynets PL
committed
May 26, 2019
1 parent
4c198d8
commit 34f30d4
Showing
53 changed files
with
16,282 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NODE_PATH=src/ | ||
REACT_APP_OWM_API_KEY=fd690720ed20f870192364c8d5e9eae1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"extends": ["airbnb", "prettier", "prettier/react"], | ||
"plugins": ["prettier"], | ||
"rules": { | ||
"react/jsx-filename-extension": [ | ||
1, | ||
{ | ||
"extensions": [".js", ".jsx"] | ||
} | ||
], | ||
"react/prop-types": 0, | ||
"react/button-has-type": 0, | ||
"no-underscore-dangle": 0, | ||
"import/imports-first": ["error", "absolute-first"], | ||
"import/newline-after-import": "error", | ||
"no-undef": 0 | ||
}, | ||
"globals": { | ||
"window": true, | ||
"document": true, | ||
"localStorage": true, | ||
"FormData": true, | ||
"FileReader": true, | ||
"Blob": true, | ||
"navigator": true | ||
}, | ||
"parser": "babel-eslint" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"singleQuote": true | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Provider } from 'react-redux'; | ||
import TWEEN from '@tweenjs/tween.js'; | ||
import './index.css'; | ||
import App from './App'; | ||
import Layout from './layout/Layout'; | ||
import * as serviceWorker from './serviceWorker'; | ||
import { store } from './state'; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); | ||
ReactDOM.render( | ||
<Provider store={store}> | ||
<Layout /> | ||
</Provider>, | ||
document.getElementById('root') | ||
); | ||
|
||
function animate() { | ||
requestAnimationFrame(animate); | ||
// [...] | ||
TWEEN.update(); | ||
// [...] | ||
} | ||
|
||
// If you want your app to work offline and load faster, you can change | ||
// unregister() to register() below. Note this comes with some pitfalls. | ||
// Learn more about service workers: https://bit.ly/CRA-PWA | ||
serviceWorker.unregister(); | ||
animate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { connect } from 'react-redux'; | ||
import { bindActionCreators } from 'redux'; | ||
import { setActiveView } from '../state/layout/actions'; | ||
import VIEWS from './views'; | ||
import Settings from './settings/Settings'; | ||
import Slider from './slider/Slider'; | ||
|
||
const LayoutContainer = styled.div` | ||
display: flex; | ||
background-color: #37393f; | ||
flex-direction: column; | ||
height: 100%; | ||
`; | ||
|
||
const Layout = props => { | ||
const { | ||
layout: { activeView } | ||
} = props; | ||
|
||
return ( | ||
<LayoutContainer> | ||
{activeView === VIEWS.SETTINGS && <Settings />} | ||
{activeView === VIEWS.WEATHER && <Slider />} | ||
</LayoutContainer> | ||
); | ||
}; | ||
|
||
function mapStateToProps(state) { | ||
return { | ||
layout: state.layout | ||
}; | ||
} | ||
|
||
function mapDispatchToProps(dispatch) { | ||
return bindActionCreators( | ||
{ | ||
setActiveView | ||
}, | ||
dispatch | ||
); | ||
} | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(Layout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import styled from 'styled-components'; | ||
|
||
export default Button = styled.button` | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { bindActionCreators } from 'redux'; | ||
import { setActiveView } from '../../state/layout/actions'; | ||
import VIEWS from '../views'; | ||
// import IntegrationReactSelect from './SelectComponents'; | ||
|
||
const Settings = props => ( | ||
<div> | ||
<button | ||
onClick={() => { | ||
props.setActiveView(VIEWS.WEATHER); | ||
}} | ||
> | ||
BACK | ||
</button> | ||
Settings | ||
</div> | ||
); | ||
|
||
function mapStateToProps(state) { | ||
return {}; | ||
} | ||
|
||
function mapDispatchToProps(dispatch) { | ||
return bindActionCreators( | ||
{ | ||
setActiveView | ||
}, | ||
dispatch | ||
); | ||
} | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(Settings); |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { bindActionCreators } from 'redux'; | ||
import { map, values } from 'ramda'; | ||
import styled from 'styled-components'; | ||
import { setActiveView } from '../../state/layout/actions'; | ||
import VIEWS from '../views'; | ||
import WeatherView from '../weather/WeatherView'; | ||
|
||
const SliederContainer = styled.div` | ||
display: flex; | ||
flex-grow: 1; | ||
flex-direction: column; | ||
`; | ||
|
||
const SettingsButton = styled.button``; | ||
|
||
const Slider = props => { | ||
const { weather } = props; | ||
|
||
return ( | ||
<SliederContainer> | ||
<SettingsButton | ||
onClick={() => { | ||
props.setActiveView(VIEWS.SETTINGS); | ||
}} | ||
> | ||
{'COG'} | ||
</SettingsButton> | ||
{values( | ||
map(data => { | ||
return <WeatherView data={data} />; | ||
}, weather) | ||
)} | ||
</SliederContainer> | ||
); | ||
}; | ||
|
||
function mapStateToProps(state) { | ||
return { | ||
weather: state.apiData.weather | ||
}; | ||
} | ||
|
||
function mapDispatchToProps(dispatch) { | ||
return bindActionCreators( | ||
{ | ||
setActiveView | ||
}, | ||
dispatch | ||
); | ||
} | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(Slider); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default Object.freeze({ | ||
SETTINGS: 'settings', | ||
WEATHER: 'weather' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import WeatherNow from './now/WeatherNow'; | ||
import WeatherWeek from './week/WatherWeek'; | ||
|
||
export default props => { | ||
const { | ||
data: { now, week } | ||
} = props; | ||
|
||
return ( | ||
<div> | ||
<WeatherNow {...now} /> | ||
<WeatherWeek days={week} /> | ||
</div> | ||
); | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react'; | ||
import Sun from './elements/Sun'; | ||
|
||
export default props => { | ||
return <Sun {...props} />; | ||
}; |
Oops, something went wrong.