Files
MAGI/components/response.js
T
2023-05-15 18:11:18 +02:00

45 lines
1001 B
JavaScript

import React from 'react';
function getStatusText(status) {
if (status === 'info')
return '情 報';
if (status === 'yes')
return '合 意';
if (status === 'no')
return '拒 絶';
if (status === 'conditional')
return '状 態';
throw new Error('Invalid status: ' + status);
}
function getStatusColor(status) {
if (status === 'info')
return '#3caee0';
if (status === 'yes')
return '#52e691';
if (status === 'no')
return '#a41413';
if (status === 'conditional')
return '#ff8d00';
throw new Error('Invalid status: ' + status);
}
export default function Response(props) {
const { status } = props;
const text = getStatusText(status);
const color = getStatusColor(status);
return React.createElement('div', { className: 'response', style: { color: color, borderColor: color } },
[
React.createElement('div', { className: 'inner' }, [text])
]);
}