Add price-chart jsx template
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
label: price-chart voorbeeld
|
||||||
|
description: Prijsgrafiek met forecast-overlay
|
||||||
|
type: price-chart
|
||||||
|
author: maik
|
||||||
|
---
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function PriceChartTemplate({ data }) {
|
||||||
|
const prices = data?.prices ?? [];
|
||||||
|
const max = Math.max(...prices, 1);
|
||||||
|
return (
|
||||||
|
<div className="widget-price-chart">
|
||||||
|
{prices.map((p, i) => (
|
||||||
|
<div key={i} className="bar" style={{ height: `${(p / max) * 100}%` }} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user