mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-11 09:11:27 +01:00
21 lines
508 B
JavaScript
21 lines
508 B
JavaScript
import React from 'react';
|
|
import StyledWrapper from './StyledWrapper';
|
|
|
|
const ResponseSize = ({size}) => {
|
|
let sizeToDisplay = ''
|
|
|
|
if(size > 1024 ) { // size is greater than 1kb
|
|
let kb = Math.floor(size / 1024);
|
|
let decimal = ((size % 1024) / 1024).toFixed(2) * 100;
|
|
sizeToDisplay = kb + '.' + decimal + 'KB';
|
|
} else {
|
|
sizeToDisplay = size + 'B'
|
|
}
|
|
|
|
return (
|
|
<StyledWrapper className="mt-3 ml-4">
|
|
{sizeToDisplay}
|
|
</StyledWrapper>
|
|
)
|
|
};
|
|
export default ResponseSize; |