@@ -3,6 +3,8 @@ import { FC } from "react"
3
3
import { makeStyles } from "@material-ui/core/styles"
4
4
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
5
5
import Skeleton from '@material-ui/lab/Skeleton' ;
6
+ import { Stack } from 'components/Stack/Stack' ;
7
+ import Box from "@material-ui/core/Box" ;
6
8
7
9
export interface WorkspaceQuotaProps {
8
10
loading : boolean
@@ -15,79 +17,56 @@ export const WorkspaceQuota: FC<WorkspaceQuotaProps> = ({ loading, count, limit
15
17
16
18
const safeCount = count ? count : 0 ;
17
19
const safeLimit = limit ? limit : 100 ;
18
- const value = Math . round ( ( safeCount / safeLimit ) * 100 )
20
+ let value = Math . round ( ( safeCount / safeLimit ) * 100 )
21
+ // we don't want to round down to zero if the count is > 0
22
+ if ( safeCount > 0 && value === 0 ) {
23
+ value = 1
24
+ }
19
25
const limitLanguage = limit ? limit : `∞`
20
26
21
27
return (
22
- < div className = { styles . root } >
23
- < span >
28
+ < Box >
29
+ < Stack spacing = { 1 } className = { styles . schedule } >
24
30
{ loading ? (
25
- < div className = { styles . item } >
26
- < div className = { styles . quotaBar } >
27
- < LinearProgress
28
- value = { value }
29
- color = "primary"
30
- />
31
- </ div >
32
- < div className = { styles . quotaLabel } >
33
- < Skeleton />
34
- </ div >
35
- < div className = { styles . quotaLabel } >
36
- FILLER TEXT IDK HOW CSS WORKS
37
- </ div >
31
+ < >
32
+ < LinearProgress
33
+ value = { value }
34
+ color = "primary"
35
+ />
36
+ < div className = { styles . scheduleLabel } >
37
+ < Skeleton className = { styles . skeleton } />
38
38
</ div >
39
- ) : (
40
- < div className = { styles . item } >
41
- < div className = { styles . quotaBar } >
42
- < LinearProgress
43
- value = { value }
44
- variant = "determinate"
45
- color = "primary"
46
- />
47
- </ div >
48
- < div className = { styles . quotaLabel } >
49
- { safeCount } of { limitLanguage } workspaces used
50
- </ div >
39
+ </ >
40
+ ) : (
41
+ < >
42
+ < LinearProgress
43
+ value = { value }
44
+ variant = "determinate"
45
+ color = "primary"
46
+ />
47
+ < div className = { styles . scheduleLabel } >
48
+ { safeCount } of { limitLanguage } workspaces used
51
49
</ div >
52
- ) }
53
- </ span >
54
- </ div >
50
+ </ >
51
+ ) }
52
+ </ Stack >
53
+ </ Box >
55
54
)
56
55
}
57
56
58
57
const useStyles = makeStyles ( ( theme ) => ( {
59
- root : {
60
- paddingLeft : theme . spacing ( 2 ) ,
61
- paddingRight : theme . spacing ( 2 ) ,
62
- borderRadius : theme . shape . borderRadius ,
63
- border : `1px solid ${ theme . palette . divider } ` ,
64
- display : "flex" ,
65
- alignItems : "center" ,
66
- color : theme . palette . text . secondary ,
58
+ schedule : {
67
59
fontFamily : MONOSPACE_FONT_FAMILY ,
68
- margin : "0px" ,
69
- [ theme . breakpoints . down ( "sm" ) ] : {
70
- display : "block" ,
71
- } ,
72
- } ,
73
- item : {
74
- minWidth : "16%" ,
75
- padding : theme . spacing ( 2 ) ,
76
- } ,
77
- quotaBar : {
78
- fontSize : 12 ,
79
- textTransform : "uppercase" ,
80
- display : "block" ,
81
- fontWeight : 600 ,
82
- wordWrap : "break-word" ,
83
- paddingTop : theme . spacing ( 0.5 ) ,
60
+ display : 'inline-flex' ,
84
61
} ,
85
- quotaLabel : {
62
+ scheduleLabel : {
86
63
fontSize : 12 ,
87
64
textTransform : "uppercase" ,
88
65
display : "block" ,
89
66
fontWeight : 600 ,
90
- wordWrap : "break-word" ,
91
- paddingTop : theme . spacing ( 0.5 ) ,
67
+ color : theme . palette . text . secondary ,
92
68
} ,
69
+ skeleton : {
70
+ minWidth : "150px" ,
71
+ }
93
72
} ) )
0 commit comments