Style gauge in box

This commit is contained in:
Hristo Nedelkov 2023-08-10 14:23:57 +03:00
parent b7011e1d1e
commit 0162a10800
2 changed files with 23 additions and 16 deletions

View File

@ -10,14 +10,14 @@ const DeviceStorageHealth = () => {
{ {
id: 'storage', id: 'storage',
label: 'Storage', label: 'Storage',
value: 450, value: 55,
color: '#E95460', color: '#E95460',
}, },
{ {
id: 'storage', id: 'storage',
label: 'Storage', label: 'Storage',
value: 45, value: 45,
color: '#E95460', color: '#E7EAEE',
}, },
] ]
return ( return (
@ -27,11 +27,16 @@ const DeviceStorageHealth = () => {
justifyContent="space-between" justifyContent="space-between"
style={{ style={{
padding: '8px 16px', padding: '8px 16px',
position: 'relative', // Make XStack a positioning context position: 'relative',
}} }}
> >
<div <div
style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, width: '100px', height: '100px' }} style={{
position: 'absolute',
right: '44px',
width: '75px',
height: '75px',
}}
> >
<StandardGauge data={data} /> <StandardGauge data={data} />
</div> </div>

View File

@ -11,9 +11,10 @@ interface StandardGaugeProps {
} }
const StandardGauge = ({ data }: StandardGaugeProps) => ( const StandardGauge = ({ data }: StandardGaugeProps) => (
// <div style={{ width: '75px', height: '75px' }}>
<ResponsivePie <ResponsivePie
data={data} data={data}
margin={{ top: 40, right: 80, bottom: 80, left: 80 }} margin={{ top: 0, right: 0, bottom: 0, left: 0 }}
innerRadius={0.65} innerRadius={0.65}
colors={datum => datum.data.color} colors={datum => datum.data.color}
fit={false} fit={false}
@ -23,6 +24,7 @@ const StandardGauge = ({ data }: StandardGaugeProps) => (
enableArcLabels={false} enableArcLabels={false}
legends={[]} legends={[]}
/> />
// </div>
) )
export default StandardGauge export default StandardGauge