diff --git a/components/Home.js b/components/Home.js
index 9857954..0ad6949 100644
--- a/components/Home.js
+++ b/components/Home.js
@@ -4,7 +4,9 @@ import PropTypes from 'prop-types'
import moment from 'moment'
import AppText from './common/app-text'
+import Asterisk from './common/Asterisk'
import Button from './common/button'
+import Footnote from './common/Footnote'
import cycleModule from '../lib/cycle'
import { getFertilityStatusForDay } from '../lib/sympto-adapter'
@@ -69,26 +71,12 @@ const Home = ({ navigate, setDate }) => {
- {phase && (
-
-
-
- {statusText}
-
-
- )}
+ {phase && {statusText}}
)
}
-const Asterisk = () => {
- return *
-}
-
const styles = StyleSheet.create({
- asterisk: {
- color: Colors.orange,
- },
container: {
backgroundColor: Colors.purple,
flex: 1,
@@ -104,12 +92,6 @@ const styles = StyleSheet.create({
marginBottom: Spacing.tiny,
marginTop: Spacing.small,
},
- asteriskLine: {
- flexDirection: 'row',
- alignContent: 'flex-start',
- marginBottom: Spacing.tiny,
- marginTop: Spacing.small,
- },
title: {
color: Colors.purpleLight,
fontFamily: Fonts.bold,
@@ -124,13 +106,6 @@ const styles = StyleSheet.create({
color: 'white',
fontSize: Sizes.subtitle,
},
- whiteText: {
- color: 'white',
- },
- greyText: {
- color: Colors.greyLight,
- paddingLeft: Spacing.base,
- },
})
Home.propTypes = {
diff --git a/components/common/Asterisk.js b/components/common/Asterisk.js
new file mode 100644
index 0000000..fb67e4d
--- /dev/null
+++ b/components/common/Asterisk.js
@@ -0,0 +1,16 @@
+import React from 'react'
+import { StyleSheet } from 'react-native'
+
+import AppText from './app-text'
+
+import { Colors } from '../../styles'
+
+const Asterisk = () => *
+
+const styles = StyleSheet.create({
+ asterisk: {
+ color: Colors.orange,
+ },
+})
+
+export default Asterisk
diff --git a/components/common/Footnote.js b/components/common/Footnote.js
new file mode 100644
index 0000000..2e1ff22
--- /dev/null
+++ b/components/common/Footnote.js
@@ -0,0 +1,43 @@
+import React from 'react'
+import PropTypes from 'prop-types'
+import { StyleSheet, View } from 'react-native'
+
+import AppText from '../common/app-text'
+import Asterisk from '../common/Asterisk'
+
+import { Colors, Spacing } from '../../styles'
+
+const Footnote = ({ children }) => {
+ if (!children) return false
+
+ return (
+
+
+
+ {children}
+
+
+ )
+}
+
+Footnote.propTypes = {
+ children: PropTypes.node,
+}
+
+const styles = StyleSheet.create({
+ container: {
+ flexDirection: 'row',
+ alignContent: 'flex-start',
+ marginBottom: Spacing.tiny,
+ marginTop: Spacing.small,
+ },
+ link: {
+ color: 'white',
+ },
+ text: {
+ color: Colors.greyLight,
+ paddingLeft: Spacing.base,
+ },
+})
+
+export default Footnote
diff --git a/test/components/common/Footnote.spec.js b/test/components/common/Footnote.spec.js
new file mode 100644
index 0000000..6c3a82e
--- /dev/null
+++ b/test/components/common/Footnote.spec.js
@@ -0,0 +1,19 @@
+import React from 'react'
+import { render } from '@testing-library/react-native'
+
+import Footnote from '../../../components/common/Footnote'
+
+describe('Footnote component', () => {
+ test('when children are present, renders them', () => {
+ const text = 'Some footnote text'
+ const { toJSON } = render({text})
+
+ expect(toJSON()).toMatchSnapshot()
+ })
+
+ test('when no children, renders nothing', () => {
+ const { toJSON } = render()
+
+ expect(toJSON()).toMatchSnapshot()
+ })
+})
diff --git a/test/components/common/__snapshots__/Footnote.spec.js.snap b/test/components/common/__snapshots__/Footnote.spec.js.snap
new file mode 100644
index 0000000..07c0e5e
--- /dev/null
+++ b/test/components/common/__snapshots__/Footnote.spec.js.snap
@@ -0,0 +1,55 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Footnote component when children are present, renders them 1`] = `
+
+
+ *
+
+
+ Some footnote text
+
+
+`;
+
+exports[`Footnote component when no children, renders nothing 1`] = `null`;