Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions components/comments/cusdis.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import { ReactCusdis } from 'react-cusdis'
import { useRouter } from 'next/router'
import { useConfig } from '@/contexts/config'
import { useTheme } from "@/contexts/theme";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
import { useTheme } from "@/contexts/theme";
import { useTheme } from '@/contexts/theme'


export default function Cusdis ({ config, post }) {
const router = useRouter()
const { link, lang, appearance } = useConfig()
const { link, lang } = useConfig()
const { scheme } = useTheme()

return (
<ReactCusdis
key={`cusdis-${scheme}`}
attrs={{
pageId: post.id,
pageTitle: post.title,
pageUrl: link + router.asPath,
theme: appearance,
theme: scheme,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see Cusdis does support an auto value. Wouldn’t it be better to use appearance here?

Copy link
Author

Choose a reason for hiding this comment

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

However, it doesn't work during actual deployment. I have no idea why, but passing 'auto' defaults to the light theme.

...config,
}}
lang={resolveLang(lang)}
Expand Down
2 changes: 1 addition & 1 deletion contexts/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ThemeContext = createContext<Context>(undefined as any)
export function ThemeProvider ({ children }: BasicProps) {
const config = useConfig()

const [theme, setTheme] = useState<Theme>(config.appearance === 'auto' ? 'system' : config.appearnce)
const [theme, setTheme] = useState<Theme>(config.appearance === 'auto' ? 'system' : config.appearance)

const [prefersDark, setPrefersDark] = useState<boolean>()

Expand Down