-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rename utility section to utility slot and update docs (#117)
## Description <!-- Write and explain of the changes introduced by this PR for the reviewers to fully understand --> ## Screenshot <!-- Provide a screenshot or gif of the change to demonstrate it --> ## Test Plan <!-- Explain what you tested and why --> <!-- Have any questions? Check out the contributing doc for more -->
- Loading branch information
Showing
17 changed files
with
81 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
| Name | Type | | ||
| :----------------- | :------------------------------------------------------------------------------------------------- | | ||
| ` utilitySection?` | `ReactNode` | | ||
| ` utilitySlot?` | `ReactNode` | | ||
| `menuItems?` | <pre>\{ <br/> text: string; <br/> url: string; <br/> iconName?: AcceptedIconNames; <br/>\}[]</pre> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createContext, Dispatch, ReactNode, SetStateAction } from 'react'; | ||
|
||
export type TopBarUtilitySlotContextValue = { | ||
topBarUtilitySlot: ReactNode; | ||
setTopBarUtilitySlot: Dispatch<SetStateAction<ReactNode>>; | ||
}; | ||
|
||
export const defaultTopBarUtilitySlotContextValue: TopBarUtilitySlotContextValue = { | ||
topBarUtilitySlot: null, | ||
setTopBarUtilitySlot: () => {}, | ||
}; | ||
export const TopBarUtilitySlotContext = createContext<TopBarUtilitySlotContextValue>( | ||
defaultTopBarUtilitySlotContextValue | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ReactNode, useContext, useEffect } from 'react'; | ||
import { TopBarUtilitySlotContext } from '../contexts/top-bar-utility-slot'; | ||
|
||
export const _useTopBarUtilitySlot = () => useContext(TopBarUtilitySlotContext); | ||
export const useTopBarUtilitySlot = (topBarUtilitySlotElement: ReactNode) => { | ||
const { setTopBarUtilitySlot } = useContext(TopBarUtilitySlotContext); | ||
|
||
useEffect(() => { | ||
setTopBarUtilitySlot(topBarUtilitySlotElement); | ||
|
||
return function () { | ||
setTopBarUtilitySlot(null); | ||
}; | ||
}, [setTopBarUtilitySlot, topBarUtilitySlotElement]); | ||
}; | ||
|
||
export type UseTopBarUtilitySlotReturnValue = undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ReactNode, useState } from 'react'; | ||
import { TopBarUtilitySlotContext } from '../contexts/top-bar-utility-slot'; | ||
|
||
export function TopBarUtilitySlot(props: { children: ReactNode }) { | ||
const { children } = props; | ||
const [topBarUtilitySlot, setTopBarUtilitySlot] = useState<ReactNode>(null); | ||
|
||
return ( | ||
<TopBarUtilitySlotContext.Provider | ||
value={{ | ||
topBarUtilitySlot: topBarUtilitySlot, | ||
setTopBarUtilitySlot: setTopBarUtilitySlot, | ||
}} | ||
> | ||
{children} | ||
</TopBarUtilitySlotContext.Provider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters