Logo
deso-ui/logoFreeBlock
A component for displaying the DeSo logo with light and dark mode support.
Install it
npx shadcn@latest add https://ui.deso.com/r/logo.jsonSource
1'use client';23import React, { useEffect, useState } from 'react';4import { useTheme } from 'next-themes';5import Image from 'next/image';6import { cn } from '@/lib/utils/deso';78export interface LogoProps {9 className?: string;10 width?: number;11 height?: number;12}1314export const Logo: React.FC<LogoProps> = ({15 className,16 width = 120,17 height = 40,18}) => {19 const { theme, resolvedTheme } = useTheme();20 const [mounted, setMounted] = useState(false);2122 // Only render after mounting to avoid hydration mismatch23 useEffect(() => {24 setMounted(true);25 }, []);2627 // Determine if we're in dark mode28 const getDarkMode = () => {29 if (!mounted) {30 // During SSR/initial render, check if document has dark class31 if (typeof document !== 'undefined') {32 return document.documentElement.classList.contains('dark');33 }34 return false;35 }3637 // Use resolvedTheme which handles system preference, fallback to theme38 const currentTheme = resolvedTheme || theme;39 return currentTheme === 'dark';40 };4142 const isDark = getDarkMode();4344 // Show a placeholder during initial render to avoid hydration mismatch45 if (!mounted) {46 return (47 <div48 className={cn('relative bg-muted animate-pulse rounded', className)}49 style={{ width, height }}50 />51 );52 }5354 return (55 <div className={cn('relative', className)} style={{ width, height }}>56 <Image57 src={isDark ? '/logo-dark.svg' : '/logo-light.svg'}58 alt="DeSo Logo"59 fill60 style={{ objectFit: 'contain' }}61 priority62 />63 </div>64 );65};
Files it writes
More from deso-ui
All 47 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Action Menuaction-menu | deso-ui | Blocks | Free | no deps | |
| Confirmation Dialogconfirmation-dialog | deso-ui | Blocks | Free | no deps | |
| Copy Buttoncopy-button | deso-ui | Blocks | Free | no deps | |
| Editoreditor | deso-ui | Blocks | Free | no deps | |
| Editor Emoji Pickereditor-emoji-picker | deso-ui | Blocks | Free | no deps | |
| Editor Markdowneditor-markdown | deso-ui | Blocks | Free | no deps | |
| Editor Uploadeditor-upload | deso-ui | Blocks | Free | no deps | |
| Feed Listfeed-list | deso-ui | Blocks | Free | no deps |
