Download src/contexts/settings-section-header-context.tsx from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 835 Bytes
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/contexts/settings-section-header-context.tsx
- Command line
-
hf download hf://SaylorTwift/openhands/src/contexts/settings-section-header-context.tsx
-
curl -L -o settings-section-header-context.tsx https://huggingface.co/SaylorTwift/openhands/resolve/main/src/contexts/settings-section-header-context.tsx
835 Bytes
| import React from "react"; | |
| interface SettingsSectionHeaderContextValue { | |
| setHideSectionHeader: (hide: boolean) => void; | |
| } | |
| const SettingsSectionHeaderContext = | |
| React.createContext<SettingsSectionHeaderContextValue | null>(null); | |
| export function SettingsSectionHeaderProvider({ | |
| setHideSectionHeader, | |
| children, | |
| }: React.PropsWithChildren<{ | |
| setHideSectionHeader: (hide: boolean) => void; | |
| }>) { | |
| const value = React.useMemo( | |
| () => ({ setHideSectionHeader }), | |
| [setHideSectionHeader], | |
| ); | |
| return ( | |
| <SettingsSectionHeaderContext.Provider value={value}> | |
| {children} | |
| </SettingsSectionHeaderContext.Provider> | |
| ); | |
| } | |
| export function useSettingsSectionHeader() { | |
| const context = React.useContext(SettingsSectionHeaderContext); | |
| return ( | |
| context ?? { | |
| setHideSectionHeader: () => {}, | |
| } | |
| ); | |
| } | |