Skip to content

Commit

Permalink
Fix#8815 fixed clear button functionaly and center aligned arrow drop…
Browse files Browse the repository at this point in the history
…down arrow (#8895)
  • Loading branch information
NitinPSingh authored Oct 30, 2024
1 parent d8bcde0 commit a0e6e62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/components/Facility/SpokeFacilityEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) {
setItem: (item: FacilitySpokeModel | FacilitySpokeRequest) => void,
processing: boolean,
) => {
const [selectedFacility, setSelectedFacility] = useState<FacilityModel>();
const [selectedFacility, setSelectedFacility] =
useState<FacilityModel | null>(null);

useEffect(() => {
setItem({ ...item, spoke: selectedFacility?.id });
Expand All @@ -99,7 +100,7 @@ export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) {
showNOptions={8}
selected={selectedFacility}
setSelected={(v) =>
v && !Array.isArray(v) && setSelectedFacility(v)
(v === null || !Array.isArray(v)) && setSelectedFacility(v)
}
errors=""
className="w-full"
Expand Down
17 changes: 5 additions & 12 deletions src/components/Form/AutoCompleteAsync.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const AutoCompleteAsync = (props: Props) => {
immediate
>
<div className="relative mt-1">
<div className="flex">
<div className="relative flex">
<ComboboxInput
id={id}
name={name}
Expand All @@ -125,12 +125,12 @@ const AutoCompleteAsync = (props: Props) => {
/>
{!disabled && (
<ComboboxButton className="absolute inset-y-0 right-0 flex items-center pr-2">
<div className="absolute right-0 top-1 mr-2 flex items-center text-lg text-secondary-900">
<div className="absolute right-0 mr-2 flex items-center text-lg text-secondary-900">
{hasSelection && !loading && !required && (
<div className="tooltip" id="clear-button">
<CareIcon
icon="l-times-circle"
className="mb-[-5px] h-4 w-4 text-secondary-800 transition-colors duration-200 ease-in-out hover:text-secondary-500"
className="h-4 w-4 text-secondary-800 transition-colors duration-200 ease-in-out hover:text-secondary-500"
onClick={(e) => {
e.preventDefault();
onChange(null);
Expand All @@ -142,16 +142,9 @@ const AutoCompleteAsync = (props: Props) => {
</div>
)}
{loading ? (
<CareIcon
icon="l-spinner"
className="-mb-1.5 animate-spin"
/>
<CareIcon icon="l-spinner" className="animate-spin" />
) : (
<CareIcon
id="dropdown-toggle"
icon="l-angle-down"
className="-mb-1.5"
/>
<CareIcon id="dropdown-toggle" icon="l-angle-down" />
)}
</div>
</ComboboxButton>
Expand Down

0 comments on commit a0e6e62

Please sign in to comment.