You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
555 B
26 lines
555 B
3 years ago
|
import { useLanguageProfiles } from "@/apis/hooks";
|
||
|
import { FunctionComponent, useMemo } from "react";
|
||
|
|
||
|
interface Props {
|
||
|
index: number | null;
|
||
|
className?: string;
|
||
|
empty?: string;
|
||
|
}
|
||
|
|
||
|
const LanguageProfile: FunctionComponent<Props> = ({
|
||
|
index,
|
||
|
className,
|
||
|
empty = "Unknown Profile",
|
||
|
}) => {
|
||
|
const { data } = useLanguageProfiles();
|
||
|
|
||
|
const name = useMemo(
|
||
|
() => data?.find((v) => v.profileId === index)?.name ?? empty,
|
||
|
[data, empty, index]
|
||
|
);
|
||
|
|
||
|
return <span className={className}>{name}</span>;
|
||
|
};
|
||
|
|
||
|
export default LanguageProfile;
|