/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import {FunctionComponent} from 'preact'; import {FlowStepIcon, FlowStepThumbnail} from './common'; import {useLocalizedStrings} from './i18n/i18n'; import {getModeDescription, useFlowResult} from './util'; const SIDE_THUMBNAIL_HEIGHT = 80; const MAIN_THUMBNAIL_HEIGHT = 120; const HeaderThumbnail: FunctionComponent<{ lhr: LH.Result, position: 'prev'|'next'|'main' }> = ({lhr, position}) => { const height = position === 'main' ? MAIN_THUMBNAIL_HEIGHT : SIDE_THUMBNAIL_HEIGHT; return (
); }; export const Header: FunctionComponent<{hashState: LH.HashState}> = ({hashState}) => { const flowResult = useFlowResult(); const {index} = hashState; const step = flowResult.steps[index]; const prevStep = flowResult.steps[index - 1]; const nextStep = flowResult.steps[index + 1]; const strings = useLocalizedStrings(); const modeDescription = getModeDescription(step.lhr.gatherMode, strings); return (
{ prevStep && <> { flowResult.steps[index - 2] &&
}
{prevStep.name} }
{step.name}
{modeDescription}
{ nextStep && <>
{nextStep.name} { flowResult.steps[index + 2] &&
} }
); };