Better document hooks, props, etc.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-05-23 14:37:39 +02:00
parent 37c8f8444c
commit 58a957f4fc
2 changed files with 27 additions and 2 deletions
@@ -37,7 +37,16 @@ export type SidebarContextType = {
* @public
*/
export type SidebarOpenState = {
/**
* Whether or not the sidebar is open and full-width. When `false`, the
* sidebar is "closed" and typically only shows icons with no text.
*/
isOpen: boolean;
/**
* A function to set whether or not the sidebar is open. Pass `true` to open
* the sidebar. Pass `false` to close it.
*/
setOpen: (open: boolean) => void;
};
@@ -82,7 +91,8 @@ export const SidebarOpenStateProvider = ({
);
/**
* Hook to read and update the sidebar's open state.
* Hook to read and update the sidebar's open state, which controls whether or
* not the sidebar is open and full-width, or closed and only displaying icons.
*
* @public
*/
@@ -37,8 +37,22 @@ export type SidebarPinStateContextType = {
* @public
*/
export type SidebarPinState = {
/**
* Whether or not the sidebar is pinned to the `open` state. When `isPinned`
* is `false`, the sidebar opens and closes on hover. When `true`, the
* sidebar is permanently opened, regardless of user interaction.
*/
isPinned: boolean;
/**
* A function to toggle the pin state of the sidebar.
*/
toggleSidebarPinState: () => any;
/**
* Whether or not the sidebar is or should be rendered in a mobile-optimized
* way.
*/
isMobile?: boolean;
};
@@ -83,7 +97,8 @@ export const SidebarPinStateProvider = ({
);
/**
* Hook to read and update sidebar pin state.
* Hook to read and update sidebar pin state, which controls whether or not the
* sidebar is pinned open.
*
* @public
*/