diff --git a/src/actions/actionTypes.js b/src/actions/actionTypes.js index 5015373..11bb904 100644 --- a/src/actions/actionTypes.js +++ b/src/actions/actionTypes.js @@ -7,3 +7,4 @@ export const MAIN = 'MAIN'; export const CHART = 'CHART'; export const HELP = 'HELP'; export const EXAMPLE = 'EXAMPLE'; +export const ABOUT = 'ABOUT'; diff --git a/src/actions/menuActions.js b/src/actions/menuActions.js index 9a15e86..3d6e23f 100644 --- a/src/actions/menuActions.js +++ b/src/actions/menuActions.js @@ -35,3 +35,9 @@ export function example() { type: types.EXAMPLE }; } + +export function about() { + return { + type: types.ABOUT + }; +} diff --git a/src/components/about.js b/src/components/about.js new file mode 100644 index 0000000..bda3746 --- /dev/null +++ b/src/components/about.js @@ -0,0 +1,64 @@ +import React, {Component} from 'react'; +import {ScrollView, View} from 'react-native'; + +import MyText from './mytext.js'; +import MyLink from './mylink.js'; +import Section from './section.js'; + +export default class About extends Component { + constructor(props) { + super(props); + } + + render() { + return ( + + +
+ + Exact Resistor Calculator v1.0.0 + + + © 2017 Tanner Collin + +
+
+ + This app was written by Tanner Collin and based off a spreadsheet he created in university to help him finish electronics labs faster. + +
+
+ + This app is free and open-source software licensed under the MIT License. + + + That means you have the right to study, change, and distribute the software and source code to anyone and for any purpose. + +
+
+ + You can find the source code and report bugs here: + + + https://github.com/tannercollin/exact-resistor-calculator + +
+
+ + Instead of donating to me, please give to the Electronic Frontier Foundation. + +
+
+ + Thanks to all the devs behind Node.js, React, React Native, and Redux. + + + Thanks to Jakub Jankiewicz for the circuit image. It and my derivatives are licensed CC BY-SA. + +
+
+
+ ); + } +} + diff --git a/src/components/menu.js b/src/components/menu.js index 45d22a7..730ba0a 100644 --- a/src/components/menu.js +++ b/src/components/menu.js @@ -22,7 +22,7 @@ export default class Menu extends Component { } render() { - const {main, chart, help, example} = this.props; + const {about, main, chart, help, example} = this.props; return ( @@ -33,7 +33,7 @@ export default class Menu extends Component { Help Example Tips - About + About diff --git a/src/components/mylink.js b/src/components/mylink.js new file mode 100644 index 0000000..cced7d6 --- /dev/null +++ b/src/components/mylink.js @@ -0,0 +1,40 @@ +import React, {Component} from 'react'; +import {Linking, Text} from 'react-native'; + +const styles = { + mylink: { + color: 'cornflowerblue', + textDecorationLine: 'underline', + }, +}; + +export default class MyLink extends Component { + constructor(props) { + super(props); + } + + handleClick = () => { + Linking.canOpenURL(this.props.url).then(supported => { + if (supported) { + Linking.openURL(this.props.url); + } else { + console.log('Don\'t know how to open URI: ' + this.props.url); + } + }); + }; + + render() { + return ( + + {this.props.children} + + ); + } +} + + + diff --git a/src/containers/aboutApp.js b/src/containers/aboutApp.js new file mode 100644 index 0000000..42dc8e6 --- /dev/null +++ b/src/containers/aboutApp.js @@ -0,0 +1,16 @@ +'use strict'; + +import React, {Component} from 'react'; +import About from '../components/about'; + +export default class AboutApp extends Component { + constructor(props) { + super(props); + } + + render() { + return ( + + ); + } +} diff --git a/src/containers/nav.js b/src/containers/nav.js index 57fece2..bf3084a 100644 --- a/src/containers/nav.js +++ b/src/containers/nav.js @@ -12,6 +12,7 @@ import ChartApp from '../containers/chartApp'; import CalcApp from '../containers/calcApp'; import HelpApp from '../containers/helpApp'; import ExampleApp from '../containers/exampleApp'; +import AboutApp from '../containers/aboutApp'; class Nav extends Component { constructor(props) { @@ -66,6 +67,8 @@ class Nav extends Component { return ; case 'example': return ; + case 'about': + return ; default: return ; } diff --git a/src/reducers/menu.js b/src/reducers/menu.js index ce1e217..3ce391a 100644 --- a/src/reducers/menu.js +++ b/src/reducers/menu.js @@ -48,6 +48,13 @@ export default function menu(state = initialState, action = {}) { page: 'example', subtitle: 'Example Usage', }; + case types.ABOUT: + return { + ...state, + isOpen: false, + page: 'about', + subtitle: 'About', + }; default: return state; }