railbird-gql/App.tsx

40 lines
1.0 KiB
TypeScript

import React from "react";
import { Text } from "react-native";
import ClientProvider from "./graphql/client";
import ShotsContainer from "./component/shot";
import { CustomGrid } from "./component/custom-grid";
import * as scale from 'd3-scale';
// TODO: restructure into object
const graphHeight = 300;
const innerGraphRowContainerPadding = 10;
const xAxisMarginTop = -15;
const topInset = 30;
const adjustedGraphHeight = graphHeight - innerGraphRowContainerPadding - xAxisMarginTop - topInset;
// Usable for mock testing
const domain = [0, 140];
const range = [adjustedGraphHeight, 30];
export const defaultTicks = [0, 20, 40, 60, 80, 100, 120, 140];
export const defaultScaleLinear = scale.scaleLinear().domain(domain).range(range);
const App: React.FC = () => {
return (
<ClientProvider>
<ShotsContainer />
<Text>test</Text>
<CustomGrid y={defaultScaleLinear} ticks={defaultTicks} />
</ClientProvider>
);
};
export default function Root() {
return (
<React.StrictMode>
<App />
</React.StrictMode>
);
}