forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Logs onboarding] Add landing page and client-side routing (elastic#1…
- Loading branch information
Showing
14 changed files
with
292 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
x-pack/plugins/observability_onboarding/public/components/app/logs_onboarding/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { useBreadcrumbs } from '@kbn/observability-plugin/public'; | ||
import React, { ComponentType, useRef, useState } from 'react'; | ||
import { | ||
FilmstripFrame, | ||
FilmstripTransition, | ||
TransitionState, | ||
} from '../../shared/filmstrip_transition'; | ||
import { Provider as WizardProvider, Step as WizardStep } from './wizard'; | ||
import { HorizontalSteps } from './wizard/horizontal_steps'; | ||
import { PageTitle } from './wizard/page_title'; | ||
import { breadcrumbsApp } from '../../../application/app'; | ||
|
||
export function LogsOnboarding() { | ||
useBreadcrumbs( | ||
[ | ||
{ | ||
text: i18n.translate( | ||
'xpack.observability_onboarding.breadcrumbs.logs', | ||
{ defaultMessage: 'Logs' } | ||
), | ||
}, | ||
], | ||
breadcrumbsApp | ||
); | ||
return <AnimatedTransitionsWizard />; | ||
} | ||
|
||
const TRANSITION_DURATION = 180; | ||
|
||
function AnimatedTransitionsWizard() { | ||
const [transition, setTransition] = useState<TransitionState>('ready'); | ||
const TransitionComponent = useRef<ComponentType>(() => null); | ||
|
||
function onChangeStep({ | ||
direction, | ||
StepComponent, | ||
}: { | ||
direction: 'back' | 'next'; | ||
StepComponent: ComponentType; | ||
}) { | ||
setTransition(direction); | ||
TransitionComponent.current = StepComponent; | ||
setTimeout(() => { | ||
setTransition('ready'); | ||
}, TRANSITION_DURATION + 10); | ||
} | ||
|
||
return ( | ||
<WizardProvider | ||
transitionDuration={TRANSITION_DURATION} | ||
onChangeStep={onChangeStep} | ||
> | ||
<EuiFlexGroup direction="column" alignItems="center"> | ||
<EuiFlexItem grow={false}> | ||
<EuiSpacer size="l" /> | ||
<PageTitle /> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false} style={{ width: '50%' }}> | ||
<HorizontalSteps /> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={1} style={{ width: '50%' }}> | ||
<FilmstripTransition | ||
duration={TRANSITION_DURATION} | ||
transition={transition} | ||
> | ||
<FilmstripFrame position="left"> | ||
{ | ||
// eslint-disable-next-line react/jsx-pascal-case | ||
transition === 'back' ? <TransitionComponent.current /> : null | ||
} | ||
</FilmstripFrame> | ||
<FilmstripFrame position="center"> | ||
<WizardStep /> | ||
</FilmstripFrame> | ||
<FilmstripFrame position="right"> | ||
{ | ||
// eslint-disable-next-line react/jsx-pascal-case | ||
transition === 'next' ? <TransitionComponent.current /> : null | ||
} | ||
</FilmstripFrame> | ||
</FilmstripTransition> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</WizardProvider> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.