Skip to content

Commit

Permalink
fix: update types
Browse files Browse the repository at this point in the history
  • Loading branch information
darleendenno committed Sep 1, 2021
1 parent 439bc39 commit 46a0813
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StatusBadge } from './StatusBadge';
import { TestingStates } from '../../Panel';
import { CallState } from '../../types';

export default {
title: 'StatusBadge',
Expand All @@ -8,13 +8,13 @@ export default {
};

export const Pass = {
args: { status: TestingStates.DONE },
args: { status: CallState.DONE },
};

export const Runs = {
args: { status: TestingStates.PENDING },
args: { status: CallState.PENDING },
};

export const Fail = {
args: { status: TestingStates.ERROR },
args: { status: CallState.ERROR },
};
16 changes: 8 additions & 8 deletions addons/interactions/src/components/StatusBadge/StatusBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { styled, typography } from '@storybook/theming';
import { TestState, TestingStates } from '../../Panel';
import { CallState } from '../../types';
import { theme } from '../../theme';

export interface StatusBadgeProps {
status: TestState;
status: `${CallState}`;
}
const {
colors: {
Expand All @@ -14,9 +14,9 @@ const {

const StyledBadge = styled.div(({ status }: StatusBadgeProps) => {
const backgroundColor = {
[TestingStates.DONE]: green,
[TestingStates.ERROR]: red,
[TestingStates.PENDING]: ochre,
[CallState.DONE]: green,
[CallState.ERROR]: red,
[CallState.PENDING]: ochre,
}[status];
return {
padding: '4px 8px',
Expand All @@ -35,9 +35,9 @@ const StyledBadge = styled.div(({ status }: StatusBadgeProps) => {

export const StatusBadge: React.FC<StatusBadgeProps> = ({ status }) => {
const badgeText = {
[TestingStates.DONE]: 'Pass',
[TestingStates.ERROR]: 'Fail',
[TestingStates.PENDING]: 'Runs',
[CallState.DONE]: 'Pass',
[CallState.ERROR]: 'Fail',
[CallState.PENDING]: 'Runs',
}[status];
return <StyledBadge status={status}>{badgeText}</StyledBadge>;
};

0 comments on commit 46a0813

Please sign in to comment.