updated docs
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
'use client';
|
||||
import { useState, FC } from "react";
|
||||
import { DropdownMenuContent, DropdownMenuLabel } from "@/components/mutual/shadcnui/dropdown-menu";
|
||||
import Link from "next/link";
|
||||
import LoadingContent from "@/components/mutual/loader/component";
|
||||
|
||||
const RenderLinkComponent: FC<{ refUrl: string, innerText: string, setisL: (isLoading: boolean) => void }> = ({ refUrl, innerText, setisL }) => {
|
||||
return (
|
||||
<Link replace href={refUrl} onClick={() => setisL(true)}>
|
||||
<DropdownMenuContent className="flex w-48 h-12 align-center justify-center text-center text-md overflow-y-hidden">
|
||||
<DropdownMenuLabel className="flex items-center justify-center">{innerText}</DropdownMenuLabel>
|
||||
</DropdownMenuContent>
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
|
||||
const RenderLoadingComponent: FC<{ setisL: (isLoading: boolean) => void }> = ({ setisL }) => {
|
||||
return (
|
||||
<DropdownMenuContent className="flex w-48 h-12 align-center justify-center text-center text-md overflow-y-hidden">
|
||||
<DropdownMenuLabel className="flex items-center justify-center">
|
||||
<LoadingContent height="h-8" size="w-8 h-8" plane="" />
|
||||
</DropdownMenuLabel>
|
||||
</DropdownMenuContent>
|
||||
)
|
||||
}
|
||||
|
||||
const LanguageSelectionItem: React.FC<{
|
||||
activeLang: string, buttonsLang: string, refUrl: string, innerText: string
|
||||
}> = ({ activeLang, buttonsLang, refUrl, innerText }) => {
|
||||
const [isL, setisL] = useState<boolean>(false);
|
||||
const isC = buttonsLang !== activeLang
|
||||
const RenderLinkProp = { refUrl, innerText, setisL }
|
||||
return (
|
||||
<>{isC && <>{isL ? <RenderLoadingComponent setisL={setisL} /> : <RenderLinkComponent {...RenderLinkProp} />}</>}</>
|
||||
)
|
||||
}
|
||||
|
||||
export default LanguageSelectionItem
|
||||
Reference in New Issue
Block a user