badguardhome/client/src/components/Settings/Clients/whoisCell.js
2019-09-25 16:11:42 +03:00

44 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { Fragment } from 'react';
import { normalizeWhois } from '../../../helpers/helpers';
import { WHOIS_ICONS } from '../../../helpers/constants';
const getFormattedWhois = (value, t) => {
const whoisInfo = normalizeWhois(value);
const whoisKeys = Object.keys(whoisInfo);
if (whoisKeys.length > 0) {
return whoisKeys.map((key) => {
const icon = WHOIS_ICONS[key];
return (
<div key={key} title={t(key)}>
{icon && (
<Fragment>
<svg className="logs__whois-icon text-muted-dark icons">
<use xlinkHref={`#${icon}`} />
</svg>
&nbsp;
</Fragment>
)}
{whoisInfo[key]}
</div>
);
});
}
return '';
};
const whoisCell = t =>
function cell(row) {
const { value } = row;
return (
<div className="logs__row logs__row--overflow">
<span className="logs__text logs__text--wrap">{getFormattedWhois(value, t)}</span>
</div>
);
};
export default whoisCell;