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)} {getPercent(dnsQueries, blockedFiltering)}
</div> </div>
<div className="card-title-stats"> <div className="card-title-stats">
Blocked by Filters Blocked by <a href="#filters">Filters</a>
</div> </div>
</div> </div>
<div className="card-chart-bg"> <div className="card-chart-bg">

View File

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

View File

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