From 1227e4c5fa54011ac38f57291fb650d37c2a3774 Mon Sep 17 00:00:00 2001 From: Oriol Torrent Florensa Date: Mon, 5 Mar 2018 19:27:13 +0100 Subject: [PATCH 1/3] Add possibility to include related data to markers --- examples/marks.js | 6 ++++++ src/common/Marks.jsx | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/examples/marks.js b/examples/marks.js index 68ba753b1..1d5d679bc 100644 --- a/examples/marks.js +++ b/examples/marks.js @@ -11,6 +11,12 @@ const marks = { 26: '26°C', 37: '37°C', 50: '50°C', + 85: { + data: { + id: 'custom_id_01234', + }, + label: '85°C', + }, 100: { style: { color: 'red', diff --git a/src/common/Marks.jsx b/src/common/Marks.jsx index b404fdaba..6d4e55e84 100644 --- a/src/common/Marks.jsx +++ b/src/common/Marks.jsx @@ -46,8 +46,12 @@ const Marks = ({ const style = vertical ? bottomStyle : leftStyle; const markStyle = markPointIsObject ? { ...style, ...markPoint.style } : style; + + const otherProps = markPointIsObject ? { ...markPoint.data } : null + return ( Date: Mon, 5 Mar 2018 19:28:52 +0100 Subject: [PATCH 2/3] Fix lint errors --- src/common/Marks.jsx | 2 +- src/createSliderWithTooltip.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/Marks.jsx b/src/common/Marks.jsx index 6d4e55e84..a445fcde8 100644 --- a/src/common/Marks.jsx +++ b/src/common/Marks.jsx @@ -47,7 +47,7 @@ const Marks = ({ const markStyle = markPointIsObject ? { ...style, ...markPoint.style } : style; - const otherProps = markPointIsObject ? { ...markPoint.data } : null + const otherProps = markPointIsObject ? { ...markPoint.data } : null; return ( Date: Tue, 6 Mar 2018 11:02:00 +0100 Subject: [PATCH 3/3] Convert it to `resetProps` --- src/common/Marks.jsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/common/Marks.jsx b/src/common/Marks.jsx index a445fcde8..951da6260 100644 --- a/src/common/Marks.jsx +++ b/src/common/Marks.jsx @@ -47,17 +47,16 @@ const Marks = ({ const markStyle = markPointIsObject ? { ...style, ...markPoint.style } : style; - const otherProps = markPointIsObject ? { ...markPoint.data } : null; + const markProps = markPointIsObject ? + { + className: markClassName, + style: markStyle, + key: point, + ...markPoint.resetProps, + } : null; return ( - - {markLabel} - + {markLabel} ); });