From 293d82336d8ebcbd4d16886de946c4be5f34bbcd Mon Sep 17 00:00:00 2001 From: Przemek Kaminski <pk@intrepidus.pl> Date: Mon, 19 Aug 2019 08:15:06 +0200 Subject: [PATCH] [Graph] add missing RangeControl.purs file --- .../GraphExplorer/RangeControl.purs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/Gargantext/Components/GraphExplorer/RangeControl.purs diff --git a/src/Gargantext/Components/GraphExplorer/RangeControl.purs b/src/Gargantext/Components/GraphExplorer/RangeControl.purs new file mode 100644 index 00000000..10e6a728 --- /dev/null +++ b/src/Gargantext/Components/GraphExplorer/RangeControl.purs @@ -0,0 +1,48 @@ +module Gargantext.Components.GraphExplorer.RangeControl + ( Props + , rangeControl + , nodeSizeControl + ) where + +import Global (readFloat) +import Prelude +import Data.Tuple.Nested ((/\)) +import Reactix as R +import Reactix.DOM.HTML as H + +import Gargantext.Components.RangeSlider as RS +import Gargantext.Utils.Range as Range +import Gargantext.Utils.Reactix as R2 + +type Props = ( + caption :: String + , sliderProps :: Record RS.Props + ) + +rangeControl :: Record Props -> R.Element +rangeControl props = R.createElement rangeControlCpt props [] + +rangeControlCpt :: R.Component Props +rangeControlCpt = R.hooksComponent "RangeButton" cpt + where + cpt {caption, sliderProps} _ = do + pure $ + H.span {} + [ H.label {} [ H.text caption ] + , RS.rangeSlider sliderProps + ] + +nodeSizeControl :: R.State Range.NumberRange -> R.Element +nodeSizeControl (state /\ setState) = + rangeControl { + caption: "Node Size" + , sliderProps: { + bounds: Range.Closed { min: 5.0, max: 15.0 } + , initialValue: state + , epsilon: 0.1 + , step: 1.0 + , width: 10.0 + , height: 5.0 + , onChange: setState <<< const + } + } -- 2.21.0