Skip to content

Commit e657d66

Browse files
committed
client: bugfix
1 parent 110c8b2 commit e657d66

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

client/src/components/ui/Select.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
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";
29
import { SelectOption } from "../../types";
310
import { AiFillCaretDown } from "react-icons/ai";
411
import { 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",

client/src/utils/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)