mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
chore(site): rename website to site
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type { SupportedFramework, SupportedStyle } from '@/types/docs';
|
||||
import { useEffect } from 'react';
|
||||
import { setPreferenceClient } from '@/utils/docs/preferences';
|
||||
|
||||
interface PreferenceUpdaterProps<F extends SupportedFramework = SupportedFramework> {
|
||||
currentFramework: F;
|
||||
currentStyle: SupportedStyle<F>;
|
||||
}
|
||||
|
||||
/**
|
||||
* PreferenceUpdater component updates user preferences in cookies.
|
||||
* This component is loaded with client:idle directive, making it non-blocking.
|
||||
* It renders nothing but updates cookies whenever framework or style changes.
|
||||
*/
|
||||
export function PreferenceUpdater<F extends SupportedFramework = SupportedFramework>({ currentFramework, currentStyle }: PreferenceUpdaterProps<F>) {
|
||||
useEffect(() => {
|
||||
setPreferenceClient(currentFramework, currentStyle);
|
||||
}, [currentFramework, currentStyle]);
|
||||
|
||||
return <></>;
|
||||
}
|
||||
Reference in New Issue
Block a user