Skip to content

Commit

Permalink
fix: mermaid theme
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Nov 28, 2023
1 parent 2babba4 commit c7064f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/widgets/shared/Mermaid.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useId, useState } from 'react'
import { useTheme } from 'next-themes'
import type { FC } from 'react'

import { useIsDark } from '~/hooks/common/use-is-dark'
import { useWrappedElementSize } from '~/providers/shared/WrappedElementProvider'

import { FixedZoomedImage } from '../../ui/image'
Expand All @@ -15,11 +15,12 @@ export const Mermaid: FC<{
const [width, setWidth] = useState<number>()
const [height, setHeight] = useState<number>()

const isDark = useTheme().theme === 'dark'
const isDark = useIsDark()

useEffect(() => {
import('mermaid').then(async (mo) => {
const mermaid = mo.default

mermaid.initialize({
theme: isDark ? 'dark' : 'default',
})
Expand Down

1 comment on commit c7064f3

@vercel
Copy link

@vercel vercel bot commented on c7064f3 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

springtide.vercel.app
shiro-git-main-innei.vercel.app
shiro-innei.vercel.app
innei.in

Please sign in to comment.