mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-19 21:16:18 +00:00
Improved SortableBarGraph test
This commit is contained in:
@@ -6,7 +6,7 @@ import { keys, values } from 'ramda';
|
||||
import './GraphCard.scss';
|
||||
|
||||
const propTypes = {
|
||||
title: PropTypes.oneOfType([ PropTypes.string, PropTypes.node ]),
|
||||
title: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
|
||||
footer: PropTypes.oneOfType([ PropTypes.string, PropTypes.node ]),
|
||||
isBarChart: PropTypes.bool,
|
||||
stats: PropTypes.object,
|
||||
@@ -65,7 +65,7 @@ const renderGraph = (title, isBarChart, stats, max, redraw) => {
|
||||
|
||||
const GraphCard = ({ title, footer, isBarChart, stats, max, redraw = false }) => (
|
||||
<Card className="mt-4">
|
||||
<CardHeader className="graph-card__header">{title}</CardHeader>
|
||||
<CardHeader className="graph-card__header">{typeof title === 'function' ? title() : title}</CardHeader>
|
||||
<CardBody>{renderGraph(title, isBarChart, stats, max, redraw)}</CardBody>
|
||||
{footer && <CardFooter className="graph-card__footer--sticky">{footer}</CardFooter>}
|
||||
</Card>
|
||||
|
||||
@@ -97,7 +97,7 @@ export default class SortableBarGraph extends React.Component {
|
||||
const { stats, sortingItems, title, extraHeaderContent, withPagination = true } = this.props;
|
||||
const { currentPageStats, pagination, max } = this.determineStats(stats, sortingItems);
|
||||
const activeCities = keys(currentPageStats);
|
||||
const computedTitle = (
|
||||
const computeTitle = () => (
|
||||
<React.Fragment>
|
||||
{title}
|
||||
<div className="float-right">
|
||||
@@ -134,7 +134,7 @@ export default class SortableBarGraph extends React.Component {
|
||||
return (
|
||||
<GraphCard
|
||||
isBarChart
|
||||
title={computedTitle}
|
||||
title={computeTitle}
|
||||
stats={currentPageStats}
|
||||
footer={pagination}
|
||||
max={max}
|
||||
|
||||
Reference in New Issue
Block a user