Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

fix(empty-state): fix dark-mode for empty-state (#547)

Jonathan Fishner99a820139861
diff --git a/src/assets/empty_state_dark.png b/src/assets/empty_state_dark.png
new file mode 100644
index 00000000..0171a1f2
Binary files /dev/null and b/src/assets/empty_state_dark.png differ
diff --git a/src/components/empty-state/empty-state.tsx b/src/components/empty-state/empty-state.tsx
index 44cd3b8c..44dfacb1 100644
--- a/src/components/empty-state/empty-state.tsx
+++ b/src/components/empty-state/empty-state.tsx
@@ -1,7 +1,9 @@
import React, { forwardRef } from 'react';
import EmptyStateImage from '@/assets/empty_state.png';
+import EmptyStateImageDark from '@/assets/empty_state_dark.png';
import { Label } from '@/components/label/label';
import { cn } from '@/lib/utils';
+import { useTheme } from '@/hooks/use-theme';
export interface EmptyStateProps {
title: string;
@@ -25,30 +27,40 @@ export const EmptyState = forwardRef<
imageClassName,
},
ref
- ) => (
- <div
- ref={ref}
- className={cn(
- 'flex flex-1 flex-col items-center justify-center space-y-1',
- className
- )}
- >
- <img
- src={EmptyStateImage}
- alt="Empty state"
- className={cn('mb-2 w-20', imageClassName)}
- />
- <Label className={cn('text-base', titleClassName)}>{title}</Label>
- <Label
+ ) => {
+ const { effectiveTheme } = useTheme();
+
+ return (
+ <div
+ ref={ref}
className={cn(
- 'text-sm font-normal text-muted-foreground',
- descriptionClassName
+ 'flex flex-1 flex-col items-center justify-center space-y-1',
+ className
)}
>
- {description}
- </Label>
- </div>
- )
+ <img
+ src={
+ effectiveTheme === 'dark'
+ ? EmptyStateImageDark
+ : EmptyStateImage
+ }
+ alt="Empty state"
+ className={cn('mb-2 w-20', imageClassName)}
+ />
+ <Label className={cn('text-base', titleClassName)}>
+ {title}
+ </Label>
+ <Label
+ className={cn(
+ 'text-sm font-normal text-muted-foreground',
+ descriptionClassName
+ )}
+ >
+ {description}
+ </Label>
+ </div>
+ );
+ }
);
EmptyState.displayName = 'EmptyState';