capitalize category name

This commit is contained in:
Andrey Meshkov 2018-10-14 23:42:25 +03:00
parent dcbee729fb
commit c9736ec0fa
3 changed files with 7 additions and 2 deletions

View file

@ -48,7 +48,7 @@ class Statistics extends Component {
{getPercent(dnsQueries, blockedFiltering)}
</div>
<div className="card-title-stats">
Blocked by Filters
Blocked by <a href="#filters">Filters</a>
</div>
</div>
<div className="card-chart-bg">

View file

@ -1,6 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { getSourceData } from '../../helpers/trackers/trackers';
import { captitalizeWords } from '../../helpers/helpers';
import './Popover.css';
@ -22,6 +23,8 @@ class Popover extends Component {
</div>
);
const categoryName = captitalizeWords(data.category);
return (
<div className="popover-wrap">
<div className="popover__trigger">
@ -34,7 +37,7 @@ class Popover extends Component {
</div>
{tracker}
<div className="popover__list-item">
Category: <strong>{data.category}</strong>
Category: <strong>{categoryName}</strong>
</div>
{source}
</div>

View file

@ -81,3 +81,5 @@ export const getPercent = (amount, number) => {
}
return 0;
};
export const captitalizeWords = text => text.split(/[ -_]/g).map(str => str.charAt(0).toUpperCase() + str.substr(1)).join(' ');