UNPKG

@kiwicom/smart-faq

Version:

46 lines (39 loc) 1.2 kB
// @flow import * as React from 'react'; import Alert from '@kiwicom/orbit-components/lib/Alert'; import Translate from '@kiwicom/nitro/lib/components/Translate'; import { CardSection } from '@kiwicom/orbit-components/lib/Card'; import BoardingPassesList from './BoardingPassesList'; import BoardingPassesLoader from './BoardingPassesLoader'; type Props = {| boardingPassesInfo: ?{| +$fragmentRefs: Object, |}, error: ?Error, |}; const BoardingPassesBoxContent = ({ boardingPassesInfo, error }: Props) => { if (error !== null) { return ( <CardSection> <Alert icon={true} type="critical" title={ <Translate t="smartfaq.boarding_pass_info.content.error_alert.title" /> } > <Translate t="smartfaq.boarding_pass_info.content.error_alert.body" /> </Alert> </CardSection> ); } // Show the loading status if there is still no data and no error return boardingPassesInfo == null ? ( <CardSection> <BoardingPassesLoader /> </CardSection> ) : ( <BoardingPassesList boardingPassesInfo={boardingPassesInfo} /> ); }; export default BoardingPassesBoxContent;