diff --git a/src/components/commons/searchbar/SearchBar.tsx b/src/components/commons/searchbar/SearchBar.tsx index e1b1255e4..e2814681c 100644 --- a/src/components/commons/searchbar/SearchBar.tsx +++ b/src/components/commons/searchbar/SearchBar.tsx @@ -68,11 +68,10 @@ export function SearchBar(props: SearchBarInterface): JSX.Element { const currentReference = refs.reference.current as Element; Object.assign(refs.floating.current?.style, { width: `${currentReference.scrollWidth}px`, - left: - `${ - currentReference.scrollLeft + - (currentReference.scrollWidth - refs.floating.current?.scrollWidth) - }px` ?? "", + left: `${ + currentReference.scrollLeft + + (currentReference.scrollWidth - refs.floating.current?.scrollWidth) + }px`, }); } @@ -113,7 +112,7 @@ export function SearchBar(props: SearchBarInterface): JSX.Element { const onChangeDebounceHandler = useMemo( () => debounce(changeHandler, 200), - [] + [], ); function onSelect(result: SearchResult): void { @@ -137,7 +136,7 @@ export function SearchBar(props: SearchBarInterface): JSX.Element { >
{ const searchResults: SearchResult[] = []; diff --git a/src/utils/index/CalculatePercentage.ts b/src/utils/index/CalculatePercentage.ts index d5fe12c35..bf37861da 100644 --- a/src/utils/index/CalculatePercentage.ts +++ b/src/utils/index/CalculatePercentage.ts @@ -1,10 +1,15 @@ export function CalculatePercentage( value1: number | undefined, - value2: number | undefined + value2: number | undefined, ): string { if (value1 === undefined || value2 === undefined) { return ""; } - return `${((value1 / value2) * 100).toFixed(2)}%`; + const result = value1 / value2; + if (isNaN(result)) { + return "0.00%"; + } + + return `${(result * 100).toFixed(2)}%`; }