From 99872cc0e41a4514a514304abfc1db383ce6fa3e Mon Sep 17 00:00:00 2001 From: Richard Dinh Date: Tue, 4 Jun 2024 16:24:59 -0400 Subject: [PATCH] getting typeahead to work correctly with styling. --- src/components/Typeahead/Input/Input.js | 24 ++++++-------- src/components/Typeahead/Typeahead.less | 8 +++-- .../Typeahead/Typeahead/Typeahead.js | 33 +++++++++++-------- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/components/Typeahead/Input/Input.js b/src/components/Typeahead/Input/Input.js index 3fd1e8490..b6656ca6c 100644 --- a/src/components/Typeahead/Input/Input.js +++ b/src/components/Typeahead/Input/Input.js @@ -6,7 +6,7 @@ import { ClearButton } from '../ClearButton/ClearButton'; export const Input = ({ ariaLabel, - className, + // className, htmlId, isDisabled, handleChange, @@ -17,35 +17,31 @@ export const Input = ({ value, }) => { return ( -
-
-
+
+
+
- + {!!isClearVisible && }
-
+ ); }; Input.propTypes = { ariaLabel: PropTypes.string.isRequired, - className: PropTypes.string, + // className: PropTypes.string, isDisabled: PropTypes.bool.isRequired, handleChange: PropTypes.func.isRequired, handleClear: PropTypes.func, diff --git a/src/components/Typeahead/Typeahead.less b/src/components/Typeahead/Typeahead.less index aef60fb37..180d3693b 100644 --- a/src/components/Typeahead/Typeahead.less +++ b/src/components/Typeahead/Typeahead.less @@ -7,6 +7,7 @@ } } &-selector { + width: 100%; position: relative; // z-index: 99; @@ -91,8 +92,11 @@ } } - .o-search-input__input-label { - z-index: 1; + .o-search-input__input { + //display: block; + &-label { + z-index: 1; + } } } diff --git a/src/components/Typeahead/Typeahead/Typeahead.js b/src/components/Typeahead/Typeahead/Typeahead.js index 2244a1586..7d7a962f0 100644 --- a/src/components/Typeahead/Typeahead/Typeahead.js +++ b/src/components/Typeahead/Typeahead/Typeahead.js @@ -1,36 +1,36 @@ import '../Typeahead.less'; -import React, { useRef, useState } from 'react'; +import React, { useRef } from 'react'; import PropTypes from 'prop-types'; import { Typeahead as DropdownTypeahead } from 'react-bootstrap-typeahead'; import getIcon from '../../iconMap'; import HighlightingOption from '../HighlightingOption/HighlightingOption'; -import { ClearButton } from '../ClearButton/ClearButton'; +// import { ClearButton } from '../ClearButton/ClearButton'; export const Typeahead = ({ ariaLabel, - className, + // className, htmlId, isDisabled, handleChange, handleInputChange, - hasClearButton, + // hasClearButton, maxResults, minLength, options, placeholder, }) => { const ref = useRef(); - const [input, setInput] = useState(''); - const isVisible = hasClearButton && input; + // const [input, setInput] = useState(''); + // const isVisible = hasClearButton && input; const handleClear = () => { ref.current.clear(); - setInput(''); + // setInput(''); }; return ( -
-
+
+
@@ -70,7 +77,7 @@ export const Typeahead = ({ }; Typeahead.propTypes = { ariaLabel: PropTypes.string.isRequired, - className: PropTypes.string, + // className: PropTypes.string, isDisabled: PropTypes.bool.isRequired, handleChange: PropTypes.func.isRequired, handleInputChange: PropTypes.func.isRequired, @@ -83,7 +90,7 @@ Typeahead.propTypes = { }; Typeahead.defaultProps = { - className: '', + // className: '', hasClearButton: false, isDisabled: false, maxResults: 5,