2022-01-01 19:04:46 +01:00
|
|
|
import React from 'react';
|
2022-01-01 19:42:38 +01:00
|
|
|
import classnames from 'classnames';
|
|
|
|
import statusCodePhraseMap from './get-status-code-phrase';
|
2022-01-01 19:04:46 +01:00
|
|
|
import StyledWrapper from './StyledWrapper';
|
|
|
|
|
2022-01-01 19:42:38 +01:00
|
|
|
const StatusCode = ({status}) => {
|
|
|
|
const getTabClassname = () => {
|
|
|
|
return classnames('mt-3', {
|
|
|
|
'text-blue-700': status >= 100 && status < 200,
|
|
|
|
'text-green-700': status >= 200 && status < 300,
|
|
|
|
'text-purple-700': status >= 300 && status < 400,
|
|
|
|
'text-yellow-700': status >= 400 && status < 500,
|
|
|
|
'text-red-700': status >= 500 && status < 600
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-01-01 19:04:46 +01:00
|
|
|
return (
|
2022-01-01 19:42:38 +01:00
|
|
|
<StyledWrapper className={getTabClassname()}>
|
|
|
|
{status} {statusCodePhraseMap[status]}
|
2022-01-01 19:04:46 +01:00
|
|
|
</StyledWrapper>
|
|
|
|
)
|
|
|
|
};
|
|
|
|
export default StatusCode;
|