diff --git a/components/FullScreenToggle.tsx b/components/FullScreenToggle.tsx new file mode 100644 index 00000000000..e6a6e645a7f --- /dev/null +++ b/components/FullScreenToggle.tsx @@ -0,0 +1,54 @@ +import type { ReactNode } from 'react'; +import React, { useState } from 'react'; + +interface FullscreenProps { + children: ReactNode; + className?: string; +} + +const FullscreenToggle: React.FC = ({ children, className = '' }) => { + const [isFullscreen, setIsFullscreen] = useState(false); + + const toggleFullscreen = () => { + if (document.fullscreenElement) { + document + .exitFullscreen() + .then(() => setIsFullscreen(false)) + .catch((err) => console.error('Error attempting to exit fullscreen:', err)); + } else { + document.documentElement + .requestFullscreen() + .then(() => setIsFullscreen(true)) + .catch((err) => console.error('Error attempting to enable fullscreen:', err)); + } + }; + + return ( +
+ + {children} +
+ ); +}; + +export default FullscreenToggle; diff --git a/components/layout/DocsLayout.tsx b/components/layout/DocsLayout.tsx index b395c9445ed..b7c0a6602a3 100644 --- a/components/layout/DocsLayout.tsx +++ b/components/layout/DocsLayout.tsx @@ -13,6 +13,7 @@ import { getAllPosts } from '../../utils/api'; import Button from '../buttons/Button'; import DocsButton from '../buttons/DocsButton'; import Feedback from '../Feedback'; +import FullscreenToggle from '../FullScreenToggle'; import Head from '../Head'; import ArrowRight from '../icons/ArrowRight'; import IconMenuCenter from '../icons/CenterMenu'; @@ -113,103 +114,105 @@ export default function DocsLayout({ post, navItems = {}, children }: IDocsLayou } return ( - -
- {showMenu && setShowMenu(false)} post={post} navigation={navigation} />} -
- {/* */} - {sidebar} -
-
- {!showMenu && ( -
- -
- )} - - {/* @TODO Will uncomment the component once it is in use */} - {/* */} - -
- -
- - {post.title} - -
-

- Found an error? Have a suggestion? - {generateEditLink(post)} -

+ + +
+ {showMenu && setShowMenu(false)} post={post} navigation={navigation} />} +
+ {/* */} + {sidebar} +
+
+ {!showMenu && ( +
+
- {post.releaseNoteLink && ( - // show only when it is related to specification (/docs/reference/specification) AND is not a pre-release - // for example, if the post's title is "3.0.0 (Pre-release)", which will not have RN, so do not render this section. -
-
- - {`What is new in v${post.title}? Have a look at the `} - - - release notes - - . -
-
- - Interested in release notes of other versions of the specification?  - - - Check  + )} + + {/* @TODO Will uncomment the component once it is in use */} + {/* */} + +
+ +
+ + {post.title} + +
+

+ Found an error? Have a suggestion? + {generateEditLink(post)} +

+
+ {post.releaseNoteLink && ( + // show only when it is related to specification (/docs/reference/specification) AND is not a pre-release + // for example, if the post's title is "3.0.0 (Pre-release)", which will not have RN, so do not render this section. +
+
+ + {`What is new in v${post.title}? Have a look at the `} + - list of release notes + release notes . - +
+
+ + Interested in release notes of other versions of the specification?  + + + Check  + + list of release notes + + . + +
+ )} +
+ + {children} +
+
+ +
+
+
- )} -
- - {children} -
-
- -
-
-
-
-
+
+
- -
+ + ); }