[TASK] Add title to new/changed flag to clarify the meaning of short 'N' and 'C' flags.
This commit is contained in:
@@ -1,15 +1,20 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
function ucFirst(string) {
|
||||||
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
export default function Flag({ item, short = false }) {
|
export default function Flag({ item, short = false }) {
|
||||||
if (item.flag !== 'default') {
|
if (item.flag !== 'default') {
|
||||||
let name = item.flag.toUpperCase();
|
let name = item.flag.toUpperCase();
|
||||||
|
let title = ucFirst(item.flag);
|
||||||
if (short === true) {
|
if (short === true) {
|
||||||
name = {
|
name = {
|
||||||
new: 'N',
|
new: 'N',
|
||||||
changed: 'C',
|
changed: 'C',
|
||||||
}[item.flag];
|
}[item.flag];
|
||||||
}
|
}
|
||||||
return <span className={`flag flag--${item.flag}`}>{name}</span>;
|
return <span className={`flag flag--${item.flag}`} title={title}>{name}</span>;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user