File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 1- import { ButtonHTMLAttributes , FC , useState , useMemo } from "react" ;
1+ import {
2+ ButtonHTMLAttributes ,
3+ FC ,
4+ useState ,
5+ useMemo ,
6+ useRef ,
7+ useEffect ,
8+ } from "react" ;
29import { SelectOption } from "../../types" ;
310import { AiFillCaretDown } from "react-icons/ai" ;
411import { FiCheck } from "react-icons/fi" ;
@@ -24,6 +31,17 @@ const Select: FC<SelectProps> = ({
2431} ) => {
2532 const [ isActive , setIsActive ] = useState < boolean > ( false ) ;
2633 const [ filterText , setFilterText ] = useState < string > ( "" ) ;
34+ const selectedRef = useRef < HTMLLIElement | null > ( null ) ;
35+
36+ useEffect (
37+ ( ) =>
38+ selectedRef . current ?. scrollIntoView ( {
39+ block : "center" ,
40+ inline : "start" ,
41+ behavior : "smooth" ,
42+ } ) ,
43+ [ isActive , selected ]
44+ ) ;
2745
2846 const filteredOptions = useMemo ( ( ) => {
2947 if ( ! filter ) return [ ...options ] ;
@@ -87,6 +105,7 @@ const Select: FC<SelectProps> = ({
87105 { filteredOptions . length > 0 ? (
88106 filteredOptions . map ( ( option , i ) => (
89107 < li
108+ ref = { option . value === selected . value ? selectedRef : undefined }
90109 onClick = { ( ) => select ( option ) }
91110 className = { cn (
92111 "flex items-center gap-4 px-4 py-1.5 text-left text-sm hover:bg-gh-blue" ,
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ class CardBuilder {
188188 line += `${ encodeURI ( b . icon ) } ,${ encodeURI ( b . label ) } ,${ color } ;` ;
189189 }
190190
191- this . url += line ;
191+ this . url += ` ${ line } &` ;
192192 }
193193
194194 return this ;
You can’t perform that action at this time.
0 commit comments