33 */
44
55import { ChangeEvent , useState } from 'react'
6- import ConfirmDialog from 'components/ConfirmDialog/ConfirmDialog'
76import Input from 'components/Form/Input'
8- import Text from 'components/Typography/Text'
97import { Flex } from 'components/Layout'
8+ import ComboSelect from 'components/Form/ComboSelect'
109
1110export interface IRange {
1211 minVal ?: number
@@ -19,13 +18,9 @@ export interface FilterRangeProps {
1918 */
2019 title ?: string
2120 /**
22- * Text displayed above the minimum value input
21+ * Text displayed as unit of ranges
2322 */
24- textMin ?: string
25- /**
26- * Text displayed above the maximum value input
27- */
28- textMax ?: string
23+ labelInput ?: string
2924 /**
3025 * Minimum number allowed
3126 */
@@ -73,8 +68,7 @@ const FilterRange = ({
7368 title,
7469 min = 0 ,
7570 max = 999999999 ,
76- textMin = 'Minimum' ,
77- textMax = 'Maximum' ,
71+ labelInput = 'MXN' ,
7872 defaultMin,
7973 defaultMax,
8074 textApplyBtn = 'Apply' ,
@@ -129,54 +123,71 @@ const FilterRange = ({
129123 }
130124
131125 return (
132- < ConfirmDialog
133- title = { title }
134- onConfirm = { apply }
135- onCancel = { reset }
136- textConfirmBtn = { textApplyBtn }
137- textCancelBtn = { textResetBtn }
126+ < ComboSelect
127+ label = { title || '' }
138128 className = { className }
139- width = { width }
129+ submitText = { textApplyBtn }
130+ clearText = { textResetBtn }
131+ hideDivider
132+ onSubmit = { apply }
133+ onClear = { reset }
134+ style = { { width } }
140135 >
141- < Flex className = "mb-3 w-72 " justifyContent = "center" >
136+ < Flex className = "mb-3 w-full " justifyContent = "center" alignItems = "center" >
142137 < div className = "grid" >
143- < Text className = "mb-1 text-xxs" fontBold = "medium" >
144- { textMin }
145- </ Text >
146138 < Input
147139 data-testid = "minVal"
148140 name = "minVal"
149141 type = "number"
150142 placeholder = { min ?. toString ( ) }
151143 className = "h-7 w-32 pl-4 text-xs bg-white"
144+ style = { { height : 40 } }
152145 min = { min }
153146 value = { range . minVal || '' }
154147 onChange = { handleChange }
155148 variant = { inputMinVariant }
149+ endAdornment = {
150+ inputMinVariant !== 'error' && (
151+ < Flex
152+ alignItems = "center"
153+ className = "h-10 pl-4 border-l border-solid border-gray-300 text-gray-500"
154+ >
155+ { labelInput }
156+ </ Flex >
157+ )
158+ }
156159 />
157160 </ div >
158161 < hr
159- className = "w-2.5 ml -3.5 mr-3.5 mb-3.5 mt-auto border-gray-900"
162+ className = "w-2.5 mx -3.5 border-gray-900"
160163 style = { { minWidth : 12 , borderTopWidth : 1.2 } }
161164 />
162165 < div className = "grid" >
163- < Text className = "mb-1 text-xxs" fontBold = "medium" >
164- { textMax }
165- </ Text >
166166 < Input
167167 data-testid = "maxVal"
168168 name = "maxVal"
169169 type = "number"
170170 placeholder = { max ?. toString ( ) }
171171 className = "h-7 w-32 text-xs bg-white"
172+ style = { { height : 40 } }
172173 max = { max }
173174 value = { range . maxVal || '' }
174175 onChange = { handleChange }
175176 variant = { inputMaxVariant }
177+ endAdornment = {
178+ inputMaxVariant !== 'error' && (
179+ < Flex
180+ alignItems = "center"
181+ className = "h-10 pl-4 border-l border-solid border-gray-300 text-gray-500"
182+ >
183+ { labelInput }
184+ </ Flex >
185+ )
186+ }
176187 />
177188 </ div >
178189 </ Flex >
179- </ ConfirmDialog >
190+ </ ComboSelect >
180191 )
181192}
182193
0 commit comments