import React from 'react'; import { Loading } from 'wdk-client/Components'; import { makeClassNameHelper } from 'wdk-client/Utils/ComponentUtils'; import { RecordClass } from 'wdk-client/Utils/WdkModel'; import { inputResultSetDescription } from './AddStepUtils'; import './BasketInput.scss'; const cx = makeClassNameHelper('BasketInput'); type BasketInputStatus = 'is-guest' | 'loading' | 'enabled'; type Props = { basketCounts: Record | undefined, inputRecordClasses: RecordClass[], isGuest: boolean, onSelectBasket: (recordClassUrlSegment: string) => void, selectBasketButtonText: string }; export const BasketInput = ({ inputRecordClasses, basketCounts, isGuest, onSelectBasket, selectBasketButtonText }: Props) => { const status: BasketInputStatus = isGuest ? 'is-guest' : basketCounts == null ? 'loading' : 'enabled'; return (
{ status === 'is-guest' &&
You must log in to access your basket.
} { status === 'loading' && } { status === 'enabled' && { inputRecordClasses.map(inputRecordClass => ) } }
) };