diff --git a/web/src/Components/Bridging/BridgeContainer.jsx b/web/src/Components/Bridging/BridgeContainer.jsx index bf6f5f8..ea718e3 100644 --- a/web/src/Components/Bridging/BridgeContainer.jsx +++ b/web/src/Components/Bridging/BridgeContainer.jsx @@ -1,18 +1,20 @@ import React, { useContext, useEffect, useState } from 'react' import styled from 'styled-components' -import { Radio, TextField, Typography } from '@equinor/eds-core-react' +import { Radio, TextField, Typography, Tabs } from '@equinor/eds-core-react' import { FractionsAPI } from '../../Api' -import { BridgingOption, CeramicDiscsValues } from "../../Enums" +import { BridgingOption, CeramicDiscsValues } from '../../Enums' import { AuthContext } from 'react-oauth2-code-pkce' -import BridgeGraph from "./BridgeGraph" -import {Tooltip} from "../Common/Tooltip"; -import {findDValue, findGraphData} from "../../Utils"; +import BridgeGraph from './BridgeGraph' +import { Tooltip } from '../Common/Tooltip' +import { findGraphData } from '../../Utils' import { ErrorToast } from '../Common/Toast' const InputWrapper = styled.div` display: flex; flex-direction: column; - justify-content: space-between; + background-color: white; + border-radius: 4px 0 4px 4px; + padding: 1rem; ` const RadioWrapper = styled.div` @@ -36,25 +38,29 @@ export default ({ bridges, mode, setMode, bridgeValue, setValue }) => { const [bridgeValueHelperText, setBridgeValueHelperText] = useState(undefined) const [bridgeValueVariant, setBridgeValueVariant] = useState(undefined) const [optimalBridgeGraphData, setOptimalBridgeGraphData] = useState([]) - const { token} = useContext(AuthContext) + const { token } = useContext(AuthContext) + const [activeTab, setActiveTab] = useState(1) + const handleChange = index => { + setActiveTab(index) + } // Load size fractions once on first render useEffect(() => { FractionsAPI.getFractionsApi(token) - .then(response => { - setSizeFractions(response.data.size_fractions) - }) - .catch(error => { - ErrorToast(`${error.response.data}`, error.response.status) - console.error('fetch error' + error) - }) + .then(response => { + setSizeFractions(response.data.size_fractions) + }) + .catch(error => { + ErrorToast(`${error.response.data}`, error.response.status) + console.error('fetch error' + error) + }) }, []) useEffect(() => { - if (bridges["Bridge"].length && sizeFractions.length ) { - const x = (findGraphData(sizeFractions, {"Bridge": bridges["Bridge"]})) + if (bridges['Bridge'].length && sizeFractions.length) { + const x = findGraphData(sizeFractions, { Bridge: bridges['Bridge'] }) setOptimalBridgeGraphData(x) - } + } }, [bridges, sizeFractions]) function bridgingOptionChange(event) { @@ -98,75 +104,89 @@ export default ({ bridges, mode, setMode, bridgeValue, setValue }) => { } return ( -
Optimal bridge:
-D10: {findDValue(optimalBridgeGraphData, 10, "Bridge")}µ
-D50: {findDValue(optimalBridgeGraphData, 50, "Bridge")}µ
-D90: {findDValue(optimalBridgeGraphData, 90, "Bridge")}µ
-