@@ -11,6 +11,7 @@ import Stats from '../Stats';
1111
1212import styles from './styles' ;
1313import Camera from "../Camera" ;
14+ import { percentComplete } from "../Stats/utils" ;
1415
1516
1617const Card = ( { } ) => {
@@ -39,6 +40,9 @@ const Card = ({ }) => {
3940
4041
4142 const theme = config . theme || 'Default' ;
43+ const vertical = config . vertical ;
44+ const round = config . round ;
45+ const percent = percentComplete ( hass , config ) ;
4246
4347
4448 const borderRadius = styles [ theme ] ? styles [ theme ] . borderRadius : styles [ 'Default' ] . borderRadius ;
@@ -131,24 +135,31 @@ const Card = ({ }) => {
131135 </ div >
132136
133137 < motion . div
134- style = { { ...styles . Content } }
138+ style = { { ...styles . Content , flexDirection : vertical ? 'column' : 'row' } }
135139 animate = { { height : hidden ? 0.0 : 'auto' , opacity : hidden ? 0.0 : 1.0 , scale : hidden ? 0.0 : 1.0 } }
136140 transition = { { ease : "easeInOut" , duration : 0.25 } }
137141 >
138- < div style = { { ...styles . Section } } >
142+ < div style = { { ...styles . Section , width : vertical ? '100%' : '50%' , height : vertical ? 'auto' : '100%' , display : 'flex' , flexDirection : 'row' , justifyContent : 'space-between' , paddingLeft : vertical ? 80 : 16 , paddingRight : vertical ? 80 : 16 } } >
139143 < PrinterView
140144 toggleVideo = { toggleVideo }
141145 hasCamera = { config . camera_entity !== undefined }
142146 />
147+ {
148+ vertical ? (
149+ < p style = { { width : '50%' , fontSize : 36 } } > { round ? Math . round ( percent ) : percent } %</ p >
150+ ) : null
151+ }
143152 </ div >
144153 < div
145154 style = { {
146155 ...styles . Section ,
147- paddingLeft : 16 ,
148- paddingRight : 32
156+ paddingLeft : vertical ? 64 : 16 ,
157+ paddingRight : vertical ? 64 : 32 ,
158+ width : vertical ? '100%' : '50%' ,
159+ height : vertical ? 'auto' : '100%'
149160 } }
150161 >
151- < Stats />
162+ < Stats showPercent = { ! vertical } />
152163 </ div >
153164 </ motion . div >
154165
0 commit comments