Skip to content

Commit

Permalink
fix(packages/viewer): add manual dark mode support in VectrealViewer …
Browse files Browse the repository at this point in the history
…component using js
  • Loading branch information
Schlomoh committed Nov 24, 2024
1 parent c5c2145 commit aaf5a14
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/viewer/src/vectreal-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,18 @@ const VectrealViewer = ({ model, ...props }: VectrealViewerProps) => {
loader = <DefaultSpinner />,
} = props;

// Check if the dark mode is manually enabled - This needs to be js because of CSS modules and minification
const isManualDarkModel = className?.split(' ').includes('dark');

return (
<div className={cn('vctrl-viewer', styles['viewer'], className)}>
<div
className={cn(
className,
'vctrl-viewer',
styles['viewer'],
isManualDarkModel && styles.dark,
)}
>
{model && (
<Suspense fallback={<SpinnerWrapper loader={loader} />}>
<Canvas
Expand Down

0 comments on commit aaf5a14

Please sign in to comment.