diff --git a/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx b/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx index bbc4c724..cf0c45de 100644 --- a/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx +++ b/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx @@ -5,14 +5,21 @@ import * as Styled from './CaseCard.styled' import { CaseCardButtons } from './CaseCardButtons/CaseCardButtons' import { CaseCardInputs } from './CaseCardInputs/CaseCardInputs' import { CaseCardParameters } from './CaseCardParameters/CaseCardParameters' - export default interface optionTypes { id: number name: string size?: string } -export const CaseCard = ({ name }: { name: string }) => { +export const CaseCard = ({ + name, + id, + removeCase, +}: { + name: string + id: string + removeCase: (id: string) => void +}) => { const [selectedModelArea, setModelArea] = useState() const [selectedComputeMethod, setComputeMethod] = useState() const [selectedGrainSize, setGrainSize] = useState() @@ -66,7 +73,7 @@ export const CaseCard = ({ name }: { name: string }) => { setModelArea={setModelArea} setComputeMethod={setComputeMethod} /> - +
diff --git a/src/features/Compute/ComputeVariogram/CaseCard/CaseCardButtons/CaseCardButtons.tsx b/src/features/Compute/ComputeVariogram/CaseCard/CaseCardButtons/CaseCardButtons.tsx index e97aba0a..5829941f 100644 --- a/src/features/Compute/ComputeVariogram/CaseCard/CaseCardButtons/CaseCardButtons.tsx +++ b/src/features/Compute/ComputeVariogram/CaseCard/CaseCardButtons/CaseCardButtons.tsx @@ -1,11 +1,21 @@ import { Button } from '@equinor/eds-core-react' import * as Styled from './CaseCardButtons.styled' -export const CaseCardButtons = ({ runCase }: { runCase: () => void }) => { +export const CaseCardButtons = ({ + id, + removeCase, + runCase, +}: { + id: string + removeCase: (id: string) => void + runCase: () => void +}) => { return ( - + diff --git a/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx b/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx index 55a91688..0b195e89 100644 --- a/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx +++ b/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx @@ -6,36 +6,40 @@ import { ComputeCaseInfoActions } from '../../../../features/Compute/ComputeVari import * as Styled from './ComputeVariogram.styled' interface Casetype { - id: number + id: string name: string } export const ComputeVariogram = () => { const [cases, setCases] = useState([ - { id: 1, name: 'Variogram Case 1' }, + { id: '1', name: 'Variogram Case 1' }, ]) - const AddCase = () => { + const addCase = () => { const newCase: Casetype = { - id: Math.floor(Math.random() * 100), + id: `${Math.floor(Math.random() * 100)}`, name: `Variogram Case ${cases.length + 1}`, } - setCases([...cases, newCase]) } + const removeCase = (id: string) => { + const newCaseList = cases.filter((c) => c.id !== id) + setCases(newCaseList) + } + return ( - + {cases.length !== 0 ? ( cases.map((c) => ( - + )) ) : ( Add a Case )} - + Add variogram case