Skip to content

Commit

Permalink
docs(v2): useThemeContext hook (#2521)
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 authored Apr 3, 2020
1 parent b4acb89 commit 3052e40
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions website/docs/theme-classic.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@ module.exports = {
}
```

## Hooks

### `useThemeContext`

React hook to access theme context. This context contains functions for setting light and dark mode and boolean property, indicating which mode is currently in use.

Usage example:

```jsx
import React from 'react';
// highlight-next-line
import useThemeContext from '@theme/hooks/useThemeContext';

const Test = () => {
// highlight-next-line
const {isDarkTheme, setLightTheme, setDarkTheme} = useThemeContext();

return <h1>Dark mode is now {isDarkTheme ? 'on' : 'off'}</h1>;
};
```

## Navbar

### Navbar Title & Logo
Expand Down

0 comments on commit 3052e40

Please sign in to comment.