Download Reactive-Resume/apps/client/src/components/brand-icon.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 799 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/Reactive-Resume/apps/client/src/components/brand-icon.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/Reactive-Resume/apps/client/src/components/brand-icon.tsx
-
curl -L -o brand-icon.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/Reactive-Resume/apps/client/src/components/brand-icon.tsx
799 Bytes
| import { forwardRef, useEffect } from "react"; | |
| import { useDebounceValue } from "usehooks-ts"; | |
| type BrandIconProps = { | |
| slug: string; | |
| }; | |
| export const BrandIcon = forwardRef<HTMLImageElement, BrandIconProps>(({ slug }, ref) => { | |
| const [debouncedSlug, setValue] = useDebounceValue(slug, 600); | |
| useEffect(() => { | |
| setValue(slug); | |
| }, [slug]); | |
| if (!slug) return null; | |
| if (debouncedSlug === "linkedin") { | |
| return ( | |
| <img | |
| ref={ref} | |
| alt="LinkedIn" | |
| className="size-5" | |
| src={`${window.location.origin}/support-logos/linkedin.svg`} | |
| /> | |
| ); | |
| } | |
| return ( | |
| <img | |
| ref={ref} | |
| alt={debouncedSlug} | |
| className="size-5" | |
| src={`https://cdn.simpleicons.org/${debouncedSlug}`} | |
| /> | |
| ); | |
| }); | |
| BrandIcon.displayName = "BrandIcon"; | |