-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25932 from storybookjs/version-non-patch-from-8.0…
….0-beta.1 Release: Prerelease 8.0.0-beta.2
- Loading branch information
Showing
79 changed files
with
979 additions
and
741 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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,44 @@ | ||
import React from 'react'; | ||
import { Icons, type IconsProps } from '@storybook/components'; | ||
import { type Call, CallStates } from '@storybook/instrumenter'; | ||
import { styled } from '@storybook/theming'; | ||
import { styled, useTheme } from '@storybook/theming'; | ||
|
||
import { transparentize } from 'polished'; | ||
import localTheme from '../theme'; | ||
import { CheckIcon, CircleIcon, PlayIcon, StopAltIcon } from '@storybook/icons'; | ||
|
||
export interface StatusIconProps { | ||
status: Call['status']; | ||
useSymbol?: IconsProps['useSymbol']; | ||
className?: string; | ||
} | ||
|
||
const { | ||
colors: { | ||
pure: { gray }, | ||
}, | ||
} = localTheme; | ||
|
||
const StyledStatusIcon = styled(Icons)<StatusIconProps>(({ theme, status }) => { | ||
const color = { | ||
[CallStates.DONE]: theme.color.positive, | ||
[CallStates.ERROR]: theme.color.negative, | ||
[CallStates.ACTIVE]: theme.color.secondary, | ||
[CallStates.WAITING]: transparentize(0.5, gray[500]), | ||
}[status]; | ||
return { | ||
width: status === CallStates.WAITING ? 6 : 12, | ||
height: status === CallStates.WAITING ? 6 : 12, | ||
color, | ||
justifySelf: 'center', | ||
}; | ||
const WarningContainer = styled.div({ | ||
width: 14, | ||
height: 14, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}); | ||
|
||
export const StatusIcon: React.FC<StatusIconProps> = ({ status, className }) => { | ||
const icon = { | ||
[CallStates.DONE]: 'check', | ||
[CallStates.ERROR]: 'stopalt', | ||
[CallStates.ACTIVE]: 'play', | ||
[CallStates.WAITING]: 'circle', | ||
}[status] as IconsProps['icon']; | ||
return ( | ||
<StyledStatusIcon | ||
data-testid={`icon-${status}`} | ||
status={status} | ||
icon={icon} | ||
className={className} | ||
/> | ||
); | ||
export const StatusIcon: React.FC<StatusIconProps> = ({ status }) => { | ||
const theme = useTheme(); | ||
|
||
switch (status) { | ||
case CallStates.DONE: { | ||
return <CheckIcon color={theme.color.positive} data-testid="icon-done" />; | ||
} | ||
case CallStates.ERROR: { | ||
return <StopAltIcon color={theme.color.negative} data-testid="icon-error" />; | ||
} | ||
case CallStates.ACTIVE: { | ||
return <PlayIcon color={theme.color.secondary} data-testid="icon-active" />; | ||
} | ||
case CallStates.WAITING: { | ||
return ( | ||
<WarningContainer data-testid="icon-waiting"> | ||
<CircleIcon color={transparentize(0.5, '#CCCCCC')} size={6} /> | ||
</WarningContainer> | ||
); | ||
} | ||
default: { | ||
return null; | ||
} | ||
} | ||
}; |
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
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
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
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
Oops, something went wrong.