diff --git a/component/charts/chart-styles.ts b/component/charts/chart-styles.ts new file mode 100644 index 0000000..73342c2 --- /dev/null +++ b/component/charts/chart-styles.ts @@ -0,0 +1,16 @@ +import { StyleSheet } from 'react-native'; + +import { colors, shadows } from '../../styles'; + +export const graphStyles = StyleSheet.create({ + container: { + backgroundColor: colors.panelWhite, + borderColor: 'black', + borderRadius: 5, + marginVertical: 10, + marginHorizontal: 15, + paddingTop: 15, + paddingHorizontal: 15, + ...shadows.standard + }, +}); diff --git a/component/charts/chart-view.tsx b/component/charts/chart-view.tsx new file mode 100644 index 0000000..56f0b30 --- /dev/null +++ b/component/charts/chart-view.tsx @@ -0,0 +1,17 @@ +import React from 'react'; +import { StyleProp, View, ViewStyle } from 'react-native'; + +import { graphStyles } from './chart-styles'; + +interface ChartViewProps { + style?: StyleProp; + children: React.ReactNode; + testID?: string; +} + +// ChartView functional component with margin props +const ChartView: React.FC = ({ children, style, testID }) => { + return {children}; +}; + +export default ChartView; \ No newline at end of file diff --git a/styles.ts b/styles.ts index 29607da..4db1dc0 100644 --- a/styles.ts +++ b/styles.ts @@ -7,4 +7,17 @@ export const colors = { blueCloth: '#539dc2', buttonBlue: '#1987ff', textWhite: '#ffffff' +}; + +export const shadows = { + standard: { + shadowColor: '#000000', + shadowOffset: { + width: 0, + height: 3 + }, + shadowOpacity: 0.1, + shadowRadius: 4.65, + elevation: 3 + }, }; \ No newline at end of file diff --git a/test/component/chart-view.test.tsx b/test/component/chart-view.test.tsx new file mode 100644 index 0000000..9c5b3d4 --- /dev/null +++ b/test/component/chart-view.test.tsx @@ -0,0 +1,32 @@ +import React from 'react'; +import { Text } from 'react-native' +import { render } from '@testing-library/react-native'; +import "@testing-library/jest-native/extend-expect"; + +import ChartView from '../../component/charts/chart-view'; + +describe('ChartView Component Tests', () => { + it('applies the passed style prop correctly', () => { + const testStyle = { backgroundColor: 'blue', padding: 10 }; + const { getByTestId } = render( + + Test Child + + ); + + const chartView = getByTestId('chart-view'); + expect(chartView.props.style).toEqual(expect.arrayContaining([testStyle])); + }); + + it('renders children correctly', () => { + const { getByText } = render( + + Child Component + + ); + + const childText = getByText('Child Component'); + console.log(childText) + expect(childText).toBeTruthy(); + }); +}); \ No newline at end of file