From e621cb4b0e9899d0b155f607807c8ea3632e3fd8 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 13 Mar 2020 01:56:54 -0400 Subject: [PATCH] Refactoring the copy-pasted buttons styles. (#26) * Refactoring the copy-pasted buttons styles. * Remove dead NegButton references This also includes some code reformatting from VS Code, but mainly it removes dangling references to the NegViews. Co-authored-by: Steve Penrod Co-authored-by: Steve Penrod --- app/components/Button.js | 6 +-- app/components/NegButton.js | 41 -------------------- app/components/PosButton.js | 41 -------------------- app/components/SensButton.js | 41 -------------------- app/constants/colors.js | 7 +++- app/views/Export.js | 47 ++++++++++++----------- app/views/Import.js | 71 +++++++++++++++++------------------ app/views/LocationTracking.js | 11 ++---- app/views/News.js | 1 - 9 files changed, 71 insertions(+), 195 deletions(-) delete mode 100644 app/components/NegButton.js delete mode 100644 app/components/PosButton.js delete mode 100644 app/components/SensButton.js diff --git a/app/components/Button.js b/app/components/Button.js index 8df6ef4e54..6835648f2c 100644 --- a/app/components/Button.js +++ b/app/components/Button.js @@ -4,14 +4,15 @@ import colors from "../constants/colors"; interface Props { label: string; + bgColor: string; onPress: () => void; } class Button extends React.Component { render() { - const { title, onPress } = this.props; + const { title, onPress, bgColor } = this.props; return ( - + {title} ); @@ -23,7 +24,6 @@ const styles = StyleSheet.create({ width: "100%", alignItems: "center", justifyContent: "center", - backgroundColor: colors.DODGER_BLUE, paddingVertical: 12, borderRadius: 4, borderWidth: StyleSheet.hairlineWidth, diff --git a/app/components/NegButton.js b/app/components/NegButton.js deleted file mode 100644 index 8d16111ca7..0000000000 --- a/app/components/NegButton.js +++ /dev/null @@ -1,41 +0,0 @@ -import * as React from "react"; -import { StyleSheet, Text, TouchableOpacity } from "react-native"; -import colors from "../constants/colors"; - -interface Props { - label: string; - onPress: () => void; -} - -class Button extends React.Component { - render() { - const { title, onPress } = this.props; - return ( - - {title} - - ); - } -} - -const styles = StyleSheet.create({ - container: { - width: "100%", - alignItems: "center", - justifyContent: "center", - backgroundColor: colors.TORCH_RED, - paddingVertical: 12, - borderRadius: 4, - borderWidth: StyleSheet.hairlineWidth, - borderColor: "rgba(255,255,255,0.7)" - }, - text: { - color: colors.WHITE, - textAlign: "center", - height: 28, - fontSize: 20, - fontWeight: '600', - } -}); - -export default Button; \ No newline at end of file diff --git a/app/components/PosButton.js b/app/components/PosButton.js deleted file mode 100644 index 94c5ec9d8c..0000000000 --- a/app/components/PosButton.js +++ /dev/null @@ -1,41 +0,0 @@ -import * as React from "react"; -import { StyleSheet, Text, TouchableOpacity } from "react-native"; -import colors from "../constants/colors"; - -interface Props { - label: string; - onPress: () => void; -} - -class PosButton extends React.Component { - render() { - const { title, onPress } = this.props; - return ( - - {title} - - ); - } -} - -const styles = StyleSheet.create({ - container: { - width: "100%", - alignItems: "center", - justifyContent: "center", - backgroundColor: colors.GREEN, - paddingVertical: 12, - borderRadius: 4, - borderWidth: StyleSheet.hairlineWidth, - borderColor: "rgba(255,255,255,0.7)" - }, - text: { - color: colors.WHITE, - textAlign: "center", - height: 28, - fontSize: 20, - fontWeight: '600', - } -}); - -export default PosButton; diff --git a/app/components/SensButton.js b/app/components/SensButton.js deleted file mode 100644 index 0d453fc0e2..0000000000 --- a/app/components/SensButton.js +++ /dev/null @@ -1,41 +0,0 @@ -import * as React from "react"; -import { StyleSheet, Text, TouchableOpacity } from "react-native"; -import colors from "../constants/colors"; - -interface Props { - label: string; - onPress: () => void; -} - -class SensButton extends React.Component { - render() { - const { title, onPress } = this.props; - return ( - - {title} - - ); - } -} - -const styles = StyleSheet.create({ - container: { - width: "100%", - alignItems: "center", - justifyContent: "center", - backgroundColor: colors.VIOLET, - paddingVertical: 12, - borderRadius: 4, - borderWidth: StyleSheet.hairlineWidth, - borderColor: "rgba(255,255,255,0.7)" - }, - text: { - color: colors.WHITE, - textAlign: "center", - height: 28, - fontSize: 20, - fontWeight: '600', - } -}); - -export default SensButton; diff --git a/app/constants/colors.js b/app/constants/colors.js index 7a135b98a2..292c4fdb88 100644 --- a/app/constants/colors.js +++ b/app/constants/colors.js @@ -8,7 +8,12 @@ const colors = { APP_BACKGROUND: '#FFF8ED', PRIMARY_TEXT: "#000", GREEN: "#32A852", - VIOLET: "#6C3794" + VIOLET: "#6C3794", + + REG_BUTTON: "#428AF8", + POS_BUTTON: "#32A852", + NEG_BUTTON: "#F8262F", + SENS_BUTTON: "#6C3794" }; export default colors; diff --git a/app/views/Export.js b/app/views/Export.js index 9d7440c692..563abe7c33 100644 --- a/app/views/Export.js +++ b/app/views/Export.js @@ -1,20 +1,19 @@ import React, { Component } from 'react'; import { - SafeAreaView, - StyleSheet, - ScrollView, - Linking, - View, - Text, - Alert, - Image, - Share + SafeAreaView, + StyleSheet, + ScrollView, + Linking, + View, + Text, + Alert, + Image + Share } from 'react-native'; import colors from "../constants/colors"; -import { WebView } from 'react-native-webview'; +import WebView from 'react-native-webview'; import Button from "../components/Button"; -import NegButton from "../components/NegButton"; import BackgroundGeolocation from '@mauron85/react-native-background-geolocation'; import {GetStoreData} from '../helpers/General'; @@ -64,7 +63,7 @@ class ExportScreen extends Component { <> - Export Data + Export Data