Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Guided onboarding] Fix steps status #142526

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@

import { EuiThemeComputed } from '@elastic/eui';
import { css } from '@emotion/react';
import { StepStatus } from '../../common/types';

export const getGuidePanelStepStyles = (euiTheme: EuiThemeComputed) => ({
export const getGuidePanelStepStyles = (euiTheme: EuiThemeComputed, stepStatus: StepStatus) => ({
stepNumber: css`
width: 24px;
height: 24px;
border-radius: 50%;
border: 2px solid ${euiTheme.colors.success};
border: 2px solid
${stepStatus === 'inactive' ? euiTheme.colors.lightShade : euiTheme.colors.success};
font-weight: ${euiTheme.font.weight.medium};
text-align: center;
line-height: 1.4;
color: ${stepStatus === 'inactive' ? euiTheme.colors.subduedText : euiTheme.colors.text};
`,
stepTitle: css`
font-weight: ${euiTheme.font.weight.bold};
font-weight: ${euiTheme.font.weight.semiBold};
color: ${stepStatus === 'inactive' ? euiTheme.colors.subduedText : euiTheme.colors.text};
.euiAccordion-isOpen & {
color: ${euiTheme.colors.title};
}
`,
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export const GuideStep = ({
navigateToStep,
}: GuideStepProps) => {
const { euiTheme } = useEuiTheme();
const styles = getGuidePanelStepStyles(euiTheme);
const styles = getGuidePanelStepStyles(euiTheme, stepStatus);

const buttonContent = (
<EuiFlexGroup gutterSize="s" responsive={false} justifyContent="center" alignItems="center">
const stepTitleContent = (
<EuiFlexGroup gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>
{stepStatus === 'complete' ? (
<EuiIcon type="checkInCircleFilled" size="l" color={euiTheme.colors.success} />
Expand All @@ -61,45 +61,49 @@ export const GuideStep = ({

return (
<div data-test-subj="guidePanelStep">
<EuiAccordion
id={accordionId}
buttonContent={buttonContent}
arrowDisplay="right"
forceState={stepStatus === 'in_progress' || stepStatus === 'active' ? 'open' : 'closed'}
>
<>
<EuiSpacer size="s" />
{stepStatus === 'complete' ? (
<>{stepTitleContent}</>
) : (
<EuiAccordion
id={accordionId}
buttonContent={stepTitleContent}
arrowDisplay="right"
initialIsOpen={stepStatus === 'in_progress' || stepStatus === 'active'}
>
<>
<EuiSpacer size="s" />

<EuiText size="s">
<ul>
{stepConfig.descriptionList.map((description, index) => {
return <li key={`description-${index}`}>{description}</li>;
})}
</ul>
</EuiText>
<EuiText size="s">
<ul>
{stepConfig.descriptionList.map((description, index) => {
return <li key={`description-${index}`}>{description}</li>;
})}
</ul>
</EuiText>

<EuiSpacer />
{(stepStatus === 'in_progress' || stepStatus === 'active') && (
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiButton
onClick={() => navigateToStep(stepConfig.id, stepConfig.location)}
fill
data-test-subj="activeStepButtonLabel"
>
{stepStatus === 'active'
? i18n.translate('guidedOnboarding.dropdownPanel.startStepButtonLabel', {
defaultMessage: 'Start',
})
: i18n.translate('guidedOnboarding.dropdownPanel.continueStepButtonLabel', {
defaultMessage: 'Continue',
})}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
)}
</>
</EuiAccordion>
<EuiSpacer />
{(stepStatus === 'in_progress' || stepStatus === 'active') && (
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiButton
onClick={() => navigateToStep(stepConfig.id, stepConfig.location)}
fill
data-test-subj="activeStepButtonLabel"
>
{stepStatus === 'active'
? i18n.translate('guidedOnboarding.dropdownPanel.startStepButtonLabel', {
defaultMessage: 'Start',
})
: i18n.translate('guidedOnboarding.dropdownPanel.continueStepButtonLabel', {
defaultMessage: 'Continue',
})}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
)}
</>
</EuiAccordion>
)}

<EuiHorizontalRule margin="l" />
</div>
Expand Down