Download apps/frontend/src/components/layout/html.component.tsx from Leon4gr45/postio: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/spaces/Leon4gr45/postio/resolve/main/apps/frontend/src/components/layout/html.component.tsx
- Command line
-
hf download hf://spaces/Leon4gr45/postio/apps/frontend/src/components/layout/html.component.tsx
-
curl -L -o html.component.tsx https://huggingface.co/spaces/Leon4gr45/postio/resolve/main/apps/frontend/src/components/layout/html.component.tsx
607 Bytes
| 'use client'; | |
| import { FC, ReactNode, useEffect, useState } from 'react'; | |
| import { useTranslationSettings } from '@gitroom/react/translation/get.transation.service.client'; | |
| export const HtmlComponent: FC = () => { | |
| const settings = useTranslationSettings(); | |
| const [dir, setDir] = useState(settings.dir()); | |
| useEffect(() => { | |
| settings.on('languageChanged', (lng) => { | |
| setDir(settings.dir()); | |
| }); | |
| }, []); | |
| useEffect(() => { | |
| const htmlElement = document.querySelector('html'); | |
| if (htmlElement) { | |
| htmlElement.setAttribute('dir', dir); | |
| } | |
| }, [dir]); | |
| return null; | |
| }; | |