UNPKG

sp-image-editor

Version:

React component version of filerobot image editor (FIE).

1 lines 1.48 kB
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import React from"react";import{useFinetune,useStore}from"../../../hooks";import restrictNumber from"../../../utils/restrictNumber";import{Warmth as CustomWarmth}from"../../../custom/finetunes";import Slider from"../../common/Slider";import{StyledLabel,StyledSliderContainer,StyledSliderInput,StyledSliderLabel,StyledSliderWrapper}from"../tools.styled";var MIN_VALUE=0,DEFAULT_VALUE={warmth:0},MAX_VALUE=200,sliderStyle={width:150,padding:0,margin:0},WarmthOptions=function(a){var b,c,d,e=a.t,f=useStore(),g=f.config,h=useFinetune(CustomWarmth,DEFAULT_VALUE),i=_slicedToArray(h,2),j=i[0],k=i[1],l=function(a){k({warmth:restrictNumber(a,MIN_VALUE,MAX_VALUE)})};return React.createElement(StyledSliderContainer,{className:"FIE_warmth-option-wrapper"},React.createElement(StyledSliderLabel,{className:"FIE_warmth-option-label"},e("warmthTool")),React.createElement(StyledSliderWrapper,null,React.createElement(Slider,{className:"FIE_warmth-option",min:MIN_VALUE,max:MAX_VALUE,width:"124px",value:null!==(b=j.warmth)&&void 0!==b?b:DEFAULT_VALUE.warmth,onChange:l,style:sliderStyle}),null!==g&&void 0!==g&&g.showInputAsLabels?React.createElement(StyledLabel,{value:null!==(c=j.warmth)&&void 0!==c?c:DEFAULT_VALUE.warmth,readOnly:!0}):React.createElement(StyledSliderInput,{value:null!==(d=j.warmth)&&void 0!==d?d:DEFAULT_VALUE.warmth,onChange:function(a){var b=a.target.value;return l(b)}})))};export default WarmthOptions;