Skip to content

Commit

Permalink
feat: add new CriticalError status
Browse files Browse the repository at this point in the history
  • Loading branch information
fulcanellee committed Feb 20, 2025
1 parent dcff49c commit 2a6005f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/steps/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export type StepsProps = {
*/
checkIsStepError?: (stepNumber: number) => boolean;

/**
* Кастомный метод для управления состоянием шага criticalError
* @param stepNumber - номер шага
* @return Флаг состояния error
*/
checkIsStepCriticalError?: (stepNumber: number) => boolean;

/**
* Кастомный метод для управления состоянием шага warning
* @param stepNumber - номер шага
Expand Down Expand Up @@ -93,6 +100,7 @@ export const Steps: React.FC<StepsProps> = ({
minSpaceBetweenSteps = 24,
checkIsStepDisabled,
checkIsStepError,
checkIsStepCriticalError,
checkIsStepWarning,
checkIsStepWaiting,
checkIsStepPositive,
Expand Down Expand Up @@ -134,6 +142,9 @@ export const Steps: React.FC<StepsProps> = ({
const disabled = checkIsStepDisabled ? checkIsStepDisabled(stepNumber) : false;
const isPositive = checkIsStepPositive ? checkIsStepPositive(stepNumber) : false;
const isError = checkIsStepError ? checkIsStepError(stepNumber) : false;
const isCriticalError = checkIsStepCriticalError
? checkIsStepCriticalError(stepNumber)
: false;
const isWarning = checkIsStepWarning ? checkIsStepWarning(stepNumber) : false;
const isWaiting = checkIsStepWaiting ? checkIsStepWaiting(stepNumber) : false;
const customStepIndicator = checkIsStepCustom && checkIsStepCustom(stepNumber);
Expand All @@ -148,6 +159,7 @@ export const Steps: React.FC<StepsProps> = ({
disabled={disabled}
isPositive={isPositive}
isError={isError}
isCriticalError={isCriticalError}
isWarning={isWarning}
isWaiting={isWaiting}
customStepIndicator={customStepIndicator}
Expand Down
10 changes: 10 additions & 0 deletions packages/steps/src/components/step/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getDataTestId } from '@alfalab/core-components-shared';
import { useFocus } from '@alfalab/hooks';
import { CheckmarkCircleMIcon } from '@alfalab/icons-glyph/CheckmarkCircleMIcon';
import { ClockMIcon } from '@alfalab/icons-glyph/ClockMIcon';
import { CrossCompactMIcon } from '@alfalab/icons-glyph/CrossCompactMIcon';
import { ExclamationCircleMIcon } from '@alfalab/icons-glyph/ExclamationCircleMIcon';

import { CommonProps } from '../../types/common-props';
Expand Down Expand Up @@ -38,6 +39,11 @@ type StepProps = {
*/
isError: boolean;

/**
* Маркер того, что текущий шаг находится в состоянии "isCriticalError"
*/
isCriticalError: boolean;

/**
* Маркер того, что текущий шаг находится в состоянии "Warning"
*/
Expand Down Expand Up @@ -78,6 +84,7 @@ export const Step: FC<StepProps> = ({
ordered,
isPositive,
isError,
isCriticalError,
isWarning,
isWaiting,
customStepIndicator,
Expand Down Expand Up @@ -117,6 +124,9 @@ export const Step: FC<StepProps> = ({
if (customStepIndicator) {
return <StepIndicator {...customStepIndicator} />;
}
if (isCriticalError) {
return <StepIndicator iconColor='negative' content={<CrossCompactMIcon />} />;
}
if (isError) {
return <StepIndicator iconColor='negative' content={<ExclamationCircleMIcon />} />;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/steps/src/docs/description.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ render(() => {
view: 'negative-alert',
content: 'Negative',
},
{
view: 'negative-cross',
content: 'CriticalError',
},
{
view: 'attention-alert',
content: 'Warning',
Expand Down

0 comments on commit 2a6005f

Please sign in to comment.