Skip to content

Commit

Permalink
chore: update useTheme doc
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraghazra committed Jan 18, 2024
1 parent 9bb3294 commit e687adb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
30 changes: 22 additions & 8 deletions packages/blade/docs/utils/useTheme.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,26 @@ import { Meta } from '@storybook/addon-docs';

The `useTheme` hook returns a `ThemeContext` object that contains the following properties:

| Property | Type | Description |
| ---------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| `theme` | [`Theme`](#theme) | The current theme object, which contains the values for various design tokens such as colors, typography, and spacing. |
| `colorScheme` | [`ColorScheme`](#colorscheme) | The current color scheme of the application, which can be either 'light' or 'dark'. |
| `platform` | [`Platform`](#platform) | The current platform of the application, which can be either 'onDesktop' or 'onMobile'. |
| `setColorScheme` | `(colorScheme: `[`ColorSchemeInput`](#colorschemeinput)`) => void` | A function that allows you to set the color scheme of the application. |
```ts
type ThemeContext = {
/**
* The current theme object, which contains the values for various design tokens such as colors, typography, and spacing.
*/
theme: Theme;
/**
* The current color scheme of the application, which can be either 'light' or 'dark'.
*/
colorScheme: ColorSchemeNames;
/**
* The current platform of the application, which can be either 'onDesktop' or 'onMobile'.
*/
platform: Platform;
/**
* A function that allows you to set the color scheme of the application.
*/
setColorScheme: (colorScheme: ColorSchemeInput) => void;
}
```
### Usage
Expand Down Expand Up @@ -78,13 +92,13 @@ To further explore the tokens in Theme, you can navigate to their respective doc
- [Elevation](?path=/story/tokens-elevation--page)
- [Typography](?path=/story/tokens-typography--page)

#### `ColorScheme`
#### `ColorSchemeNames`

The current color scheme of the application. Can be either `'dark'` or `'light'`.
If color scheme is set to 'system' using `setColorScheme`, the colorScheme property will return `'dark'` or `'light'` based on the user's system preferences.

```tsx
type ColorScheme = 'dark' | 'light';
type ColorSchemeNames = 'dark' | 'light';
```

#### `Platform`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as radioStories from '../../components/Radio/Radio.stories';
import * as switchStories from '../../components/Switch/Switch.stories';
import * as textInputStories from '../../components/Input/TextInput/TextInput.stories';
import * as otpInputStories from '../../components/Input/OTPInput/OTPInput.stories';
// import * as autoCompleteStories from '../../components/Input/DropdownInputTriggers/AutoComplete.stories';
import * as autoCompleteStories from '../../components/Input/DropdownInputTriggers/AutoComplete.stories';
import { Card, CardBody } from '~components/Card';
import { Box } from '~components/Box';
import { Heading } from '~components/Typography';
Expand Down Expand Up @@ -61,7 +61,7 @@ const allStories = [
...Object.values(composeStories(radioStories)),
...Object.values(composeStories(switchStories)),
...Object.values(composeStories(chipGroupStories)),
// ...Object.values(composeStories(autoCompleteStories)),
...Object.values(composeStories(autoCompleteStories)),
...Object.values(composeStories(accordionStories)),
...Object.values(composeStories(collapsibleStories)),
...Object.values(composeStories(modalStories)),
Expand Down

0 comments on commit e687adb

Please sign in to comment.