@@ -20,19 +20,25 @@ export interface IStyledStatusIndicatorProps extends ThemeProps<DefaultTheme> {
2020 readonly $type ?: IAvatarProps [ 'status' ] | 'active' ;
2121}
2222
23+ const StatusColorParams = {
24+ active : { hue : 'crimson' , light : { shade : 700 } , dark : { shade : 600 } } ,
25+ available : { hue : 'mint' , light : { shade : 500 } , dark : { shade : 400 } } ,
26+ away : { hue : 'orange' , light : { shade : 500 } , dark : { shade : 400 } } ,
27+ transfers : { hue : 'azure' , light : { shade : 500 } , dark : { shade : 400 } } ,
28+ offline : { hue : 'grey' , light : { shade : 500 } , dark : { shade : 400 } }
29+ } ;
30+
2331export function getStatusColor (
2432 theme : IStyledStatusIndicatorProps [ 'theme' ] ,
2533 type ?: IStyledStatusIndicatorProps [ '$type' ]
2634) : string {
27- return (
28- {
29- active : getColor ( { hue : 'crimson' , light : { shade : 700 } , dark : { shade : 600 } , theme } ) ,
30- available : getColor ( { hue : 'mint' , light : { shade : 500 } , dark : { shade : 400 } , theme } ) ,
31- away : getColor ( { hue : 'orange' , light : { shade : 500 } , dark : { shade : 400 } , theme } ) ,
32- transfers : getColor ( { hue : 'azure' , light : { shade : 500 } , dark : { shade : 400 } , theme } ) ,
33- offline : getColor ( { hue : 'grey' , light : { shade : 500 } , dark : { shade : 400 } , theme } )
34- } [ type as string ] || 'transparent'
35- ) ;
35+ if ( type === undefined ) {
36+ return 'transparent' ;
37+ }
38+
39+ const colorArgs = StatusColorParams [ type ] ;
40+
41+ return getColor ( { ...colorArgs , theme } ) ;
3642}
3743
3844export function getStatusBorderOffset ( props : IStyledStatusIndicatorProps ) : string {
0 commit comments