/
githubmirror
/
docusaurus
Обзор
Документация
Войти
/
githubmirror
/
docusaurus
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/docusaurus-theme-classic/src/theme/BlogSidebar/index.tsx
24 строки
814 B
Sébastien Lorber
refactor: prepare types for React 19 (#10746)
06 дек 2024, 20:03
Не верифицирован
06 дек 2024, 20:03
f9825af
Код
Авторство
О чём код?
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import React, {type ReactNode} from 'react'; import {useWindowSize} from '@docusaurus/theme-common'; import BlogSidebarDesktop from '@theme/BlogSidebar/Desktop'; import BlogSidebarMobile from '@theme/BlogSidebar/Mobile'; import type {Props} from '@theme/BlogSidebar'; export default function BlogSidebar({sidebar}: Props): ReactNode { const windowSize = useWindowSize(); if (!sidebar?.items.length) { return null; } // Mobile sidebar doesn't need to be server-rendered if (windowSize === 'mobile') { return <BlogSidebarMobile sidebar={sidebar} />; } return <BlogSidebarDesktop sidebar={sidebar} />; }