File tree Expand file tree Collapse file tree 5 files changed +23
-12
lines changed
Expand file tree Collapse file tree 5 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ const TextInput = ({
2222 required,
2323 disabled,
2424 size = 'default' ,
25+ noMarginBottom = false ,
2526 defaultValue = '' ,
2627 onChange,
2728 ...rest
@@ -38,7 +39,7 @@ const TextInput = ({
3839
3940 return (
4041 < div
41- css = { textInputContainerStyles ( size ) }
42+ css = { textInputContainerStyles ( size , noMarginBottom ) }
4243 className = 'ds-text-input-container'
4344 >
4445 { errorMessage ? < div css = { textInputErrorBarStyles } /> : null }
Original file line number Diff line number Diff line change @@ -2,15 +2,18 @@ import { css } from '@emotion/react'
22import { getThemedColor } from '../../../../lib/theme'
33import { TextInputProps } from './types'
44
5- export const textInputContainerStyles = ( size : TextInputProps [ 'size' ] ) => css `
5+ export const textInputContainerStyles = (
6+ size : TextInputProps [ 'size' ] ,
7+ noMarginBottom ?: boolean ,
8+ ) => css `
69 position : relative;
710 height : 100% ;
811 width : 100% ;
912 display : flex;
1013 justify-content : flex-start;
1114 align-items : flex-start;
1215 gap : ${ size === 'small' ? '12px' : '16px' } ;
13- margin-bottom : 20px ;
16+ margin-bottom : ${ noMarginBottom ? '0' : ' 20px' } ;
1417`
1518
1619export const textInputErrorBarStyles = css `
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export type TextInputProps = Omit<
1111 required ?: boolean
1212 disabled ?: boolean
1313 size ?: 'small' | 'default'
14+ noMarginBottom ?: boolean
1415 defaultValue ?: string
1516 onChange ?: ( e : React . ChangeEvent < HTMLInputElement > ) => void
1617}
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ const Search = ({
106106 } , [ open ] )
107107
108108 const endElement = filterText . length ? (
109- < CloseButton style = { { marginTop : '-12px ' } } onClick = { handleOnClear } />
109+ < CloseButton style = { { marginTop : '8px ' } } onClick = { handleOnClear } />
110110 ) : null
111111
112112 const resultsVisible =
@@ -121,12 +121,17 @@ const Search = ({
121121 } else if ( isFocused ) {
122122 iconFillColor = getThemedColor ( 'primary' , 700 )
123123 }
124-
124+ const iconSize = size === 'small' ? '16px' : '20px'
125125 return (
126126 < div ref = { containerRef } style = { { position : 'relative' , width : '100%' } } >
127127 < InputGroup
128128 startElement = {
129- < SearchIcon fill = { iconFillColor } style = { { marginTop : '-12px' } } />
129+ < SearchIcon
130+ width = { iconSize }
131+ height = { iconSize }
132+ fill = { iconFillColor }
133+ style = { { marginTop : '8px' } }
134+ />
130135 }
131136 endElement = { endElement }
132137 >
@@ -150,6 +155,7 @@ const Search = ({
150155 aria-autocomplete = 'list'
151156 disabled = { disabled }
152157 size = { size }
158+ noMarginBottom
153159 onKeyDown = { ( e ) => {
154160 if ( ! resultsVisible ) return
155161
@@ -197,13 +203,11 @@ const Search = ({
197203 < Portal container = { containerRef } >
198204 < Box
199205 position = 'absolute'
200- marginTop = '-20px'
201206 width = '100%'
202207 backgroundColor = 'white'
203- border = ' 1px solid'
208+ border = { displayResults === 'custom' ? 'none' : ' 1px solid'}
204209 borderColor = 'gray.200'
205210 borderRadius = 'md'
206- boxShadow = 'md'
207211 zIndex = { 1000 }
208212 overflowY = 'auto'
209213 maxHeight = { resultsMaxHeight }
Original file line number Diff line number Diff line change @@ -3,13 +3,15 @@ import React from 'react'
33import { Icon , IconProps } from '@chakra-ui/react'
44
55export const SearchIcon = ( props : IconProps & { fill ?: string } ) => {
6- const { fill } = props
6+ const { fill, width : widthProp , height : heightProp , ... rest } = props
77 const pathFill = fill || 'currentColor'
8+ const width = widthProp ?? '20'
9+ const height = heightProp ?? widthProp ?? '20'
810 return (
911 < Icon { ...props } fill = { pathFill } >
1012 < svg
11- width = '20'
12- height = '20'
13+ width = { width as string }
14+ height = { height as string }
1315 viewBox = '0 0 20 20'
1416 fill = 'none'
1517 xmlns = 'http://www.w3.org/2000/svg'
You can’t perform that action at this time.
0 commit comments