Skip to content
Snippets Groups Projects
Commit d25af176 authored by Maria Zadnepryanets's avatar Maria Zadnepryanets Committed by bl00dymarie
Browse files

Resolve "Stats"

parent d3756453
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ const Icon = createIconSetFromIcoMoon(iconConfig, '', 'Menu') ...@@ -10,7 +10,7 @@ const Icon = createIconSetFromIcoMoon(iconConfig, '', 'Menu')
const MenuIcon = ({ isActive, name }) => { const MenuIcon = ({ isActive, name }) => {
const color = isActive ? Colors.greyDark : Colors.grey const color = isActive ? Colors.greyDark : Colors.grey
return <Icon name={name} size={Sizes.huge} color={color} /> return <Icon name={name} size={Sizes.icon} color={color} />
} }
MenuIcon.propTypes = { MenuIcon.propTypes = {
......
...@@ -4,7 +4,7 @@ import PropTypes from 'prop-types' ...@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import AppText from './app-text' import AppText from './app-text'
import { Spacing, Typography } from '../../styles' import { Sizes, Spacing, Typography } from '../../styles'
const Table = ({ tableContent }) => { const Table = ({ tableContent }) => {
return ( return (
...@@ -56,11 +56,11 @@ Cell.propTypes = { ...@@ -56,11 +56,11 @@ Cell.propTypes = {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
accentOrange: { accentOrange: {
...Typography.accentOrange, ...Typography.accentOrange,
fontSize: 18, fontSize: Sizes.small,
}, },
accentPurpleBig: { accentPurpleBig: {
...Typography.accentPurpleBig, ...Typography.accentPurpleBig,
marginRight: Spacing.base, marginRight: Spacing.small,
}, },
cellLeft: { cellLeft: {
alignItems: 'flex-end', alignItems: 'flex-end',
......
...@@ -99,7 +99,7 @@ class Home extends Component { ...@@ -99,7 +99,7 @@ class Home extends Component {
{phase && ( {phase && (
<View style={styles.line}> <View style={styles.line}>
<Asterisk /> <Asterisk />
<AppText linkStyle={styles.whiteText}> <AppText linkStyle={styles.whiteText} style={styles.greyText}>
{statusText} {statusText}
</AppText> </AppText>
</View> </View>
...@@ -147,6 +147,9 @@ const styles = StyleSheet.create({ ...@@ -147,6 +147,9 @@ const styles = StyleSheet.create({
}, },
whiteText: { whiteText: {
color: 'white', color: 'white',
},
greyText: {
color: Colors.greyLight,
} }
}) })
......
import React from 'react' import React from 'react'
import { ImageBackground, StyleSheet, View } from 'react-native' import { Dimensions, ImageBackground, StyleSheet, View } from 'react-native'
import AppPage from './common/app-page' import AppPage from './common/app-page'
import AppText from './common/app-text' import AppText from './common/app-text'
...@@ -10,9 +10,11 @@ import cycleModule from '../lib/cycle' ...@@ -10,9 +10,11 @@ import cycleModule from '../lib/cycle'
import {getCycleLengthStats as getCycleInfo} from '../lib/cycle-length' import {getCycleLengthStats as getCycleInfo} from '../lib/cycle-length'
import {stats as labels} from '../i18n/en/labels' import {stats as labels} from '../i18n/en/labels'
import { Spacing, Typography } from '../styles' import { Sizes, Spacing, Typography } from '../styles'
import { fontRatio } from '../config'
const image = require('../assets/cycle-icon.png') const image = require('../assets/cycle-icon.png')
const screen = Dimensions.get('screen')
const Stats = () => { const Stats = () => {
const cycleLengths = cycleModule().getAllCycleLengths() const cycleLengths = cycleModule().getAllCycleLengths()
...@@ -20,13 +22,15 @@ const Stats = () => { ...@@ -20,13 +22,15 @@ const Stats = () => {
const hasAtLeastOneCycle = numberOfCycles >= 1 const hasAtLeastOneCycle = numberOfCycles >= 1
const cycleData = hasAtLeastOneCycle ? getCycleInfo(cycleLengths) const cycleData = hasAtLeastOneCycle ? getCycleInfo(cycleLengths)
: { minimum: '', maximum: '', stdDeviation: '' } : { minimum: '', maximum: '', stdDeviation: '' }
const statsData = [ const statsData = [
[cycleData.minimum, labels.minLabel], [cycleData.minimum, labels.minLabel],
[cycleData.maximum, labels.maxLabel], [cycleData.maximum, labels.maxLabel],
[cycleData.stdDeviation ? cycleData.stdDeviation : '', labels.stdLabel], [cycleData.stdDeviation ? cycleData.stdDeviation : '', labels.stdLabel],
[numberOfCycles, labels.basisOfStatsEnd] [numberOfCycles, labels.basisOfStatsEnd]
] ]
const height = screen.height * 0.2
const marginTop = (height / 8 - Sizes.icon / fontRatio) / 4
return ( return (
<AppPage contentContainerStyle={styles.pageContainer}> <AppPage contentContainerStyle={styles.pageContainer}>
<Segment last style={styles.pageContainer}> <Segment last style={styles.pageContainer}>
...@@ -38,12 +42,12 @@ const Stats = () => { ...@@ -38,12 +42,12 @@ const Stats = () => {
<ImageBackground <ImageBackground
source={image} source={image}
imageStyle={styles.image} imageStyle={styles.image}
style={styles.imageContainter} style={[styles.imageContainter, { height }]}
> >
<AppText <AppText
numberOfLines={1} numberOfLines={1}
ellipsizeMode="clip" ellipsizeMode="clip"
style={styles.accentPurpleGiant} style={[styles.accentPurpleGiant, { marginTop }]}
> >
{cycleData.mean} {cycleData.mean}
</AppText> </AppText>
...@@ -72,15 +76,14 @@ const column = { ...@@ -72,15 +76,14 @@ const column = {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
accentOrange: { accentOrange: {
...Typography.accentOrange, ...Typography.accentOrange,
fontSize: 20, fontSize: Sizes.small,
}, },
accentPurpleGiant: { accentPurpleGiant: {
...Typography.accentPurpleGiant, ...Typography.accentPurpleGiant,
}, },
accentPurpleHuge: { accentPurpleHuge: {
...Typography.accentPurpleHuge, ...Typography.accentPurpleHuge,
marginRight: Spacing.base, marginTop: Spacing.base * (-1),
marginTop: -15,
}, },
container: { container: {
alignItems: 'center', alignItems: 'center',
...@@ -97,15 +100,14 @@ const styles = StyleSheet.create({ ...@@ -97,15 +100,14 @@ const styles = StyleSheet.create({
paddingTop: Spacing.small, paddingTop: Spacing.small,
}, },
image: { image: {
height: 120, marginLeft: Spacing.large,
marginLeft: 20, marginTop: Spacing.large,
marginTop: 20,
resizeMode: 'contain', resizeMode: 'contain',
width: 120,
}, },
imageContainter: { imageContainter: {
paddingTop: 40, paddingTop: Spacing.large * 2,
marginBottom: 20, marginBottom: Spacing.large,
}, },
pageContainer: { pageContainer: {
marginVertical: Spacing.base, marginVertical: Spacing.base,
......
...@@ -16,6 +16,7 @@ export const sizes = { ...@@ -16,6 +16,7 @@ export const sizes = {
subtitle: 22 / fontRatio, subtitle: 22 / fontRatio,
title: 24 / fontRatio, title: 24 / fontRatio,
huge: 32 / fontRatio, huge: 32 / fontRatio,
icon: 40 / fontRatio,
} }
const accentText = { const accentText = {
...@@ -31,7 +32,7 @@ const accentTextBig = { ...@@ -31,7 +32,7 @@ const accentTextBig = {
const accentTextGiant = { const accentTextGiant = {
...accentText, ...accentText,
fontSize: 50 / fontRatio, fontSize: sizes.icon / fontRatio,
} }
const accentTextHuge = { const accentTextHuge = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment