2021-03-27 16:16:14 +01:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
const CustomRow = ({ row }) => {
|
2021-10-14 17:39:53 +02:00
|
|
|
const { configName, configType, state, onClick } = row;
|
2021-03-27 16:16:14 +01:00
|
|
|
|
2021-10-14 17:39:53 +02:00
|
|
|
const stateStyle = (stateStr) => {
|
2021-10-14 17:13:12 +02:00
|
|
|
const style = {
|
|
|
|
display: 'inline-flex',
|
|
|
|
padding: '0 10px',
|
|
|
|
borderRadius: '12px',
|
|
|
|
height: '24px',
|
|
|
|
alignItems: 'center',
|
|
|
|
fontWeight: '500',
|
|
|
|
};
|
|
|
|
|
2021-10-14 17:39:53 +02:00
|
|
|
if (stateStr === 'Only in DB') {
|
2021-10-14 17:13:12 +02:00
|
|
|
style.backgroundColor = '#cbf2d7';
|
|
|
|
style.color = '#1b522b';
|
|
|
|
}
|
|
|
|
|
2021-10-14 17:39:53 +02:00
|
|
|
if (stateStr === 'Only in sync dir') {
|
2021-10-14 17:13:12 +02:00
|
|
|
style.backgroundColor = '#f0cac7';
|
|
|
|
style.color = '#3d302f';
|
|
|
|
}
|
|
|
|
|
2021-10-14 17:39:53 +02:00
|
|
|
if (stateStr === 'Different') {
|
2021-10-14 17:13:12 +02:00
|
|
|
style.backgroundColor = '#e8e6b7';
|
|
|
|
style.color = '#4a4934';
|
|
|
|
}
|
|
|
|
|
|
|
|
return style;
|
|
|
|
};
|
2021-03-27 16:16:14 +01:00
|
|
|
|
|
|
|
return (
|
2021-10-14 17:39:53 +02:00
|
|
|
<tr onClick={() => onClick(configType, configName)}>
|
2021-03-27 16:16:14 +01:00
|
|
|
<td>
|
2021-10-14 17:39:53 +02:00
|
|
|
<p>{configName}</p>
|
2021-03-27 16:16:14 +01:00
|
|
|
</td>
|
|
|
|
<td>
|
2021-10-14 17:39:53 +02:00
|
|
|
<p>{configType}</p>
|
2021-03-27 16:16:14 +01:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<p style={stateStyle(state)}>{state}</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-10-14 17:13:12 +02:00
|
|
|
export default CustomRow;
|