-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor BudgetMonthCountContext to tsx (#1722)
* refactor BudgetMonthCountContext to tsx * add release notes
- Loading branch information
Showing
3 changed files
with
41 additions
and
17 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
packages/desktop-client/src/components/budget/BudgetMonthCountContext.js
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
packages/desktop-client/src/components/budget/BudgetMonthCountContext.tsx
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,35 @@ | ||
import React, { | ||
createContext, | ||
type Dispatch, | ||
type ReactNode, | ||
type SetStateAction, | ||
useContext, | ||
useState, | ||
} from 'react'; | ||
|
||
type BudgetMonthCountContextValue = { | ||
displayMax: number; | ||
setDisplayMax: Dispatch<SetStateAction<number>>; | ||
}; | ||
|
||
let BudgetMonthCountContext = createContext<BudgetMonthCountContextValue>(null); | ||
|
||
type BudgetMonthCountProviderProps = { | ||
children: ReactNode; | ||
}; | ||
|
||
export function BudgetMonthCountProvider({ | ||
children, | ||
}: BudgetMonthCountProviderProps) { | ||
let [displayMax, setDisplayMax] = useState(1); | ||
|
||
return ( | ||
<BudgetMonthCountContext.Provider value={{ displayMax, setDisplayMax }}> | ||
{children} | ||
</BudgetMonthCountContext.Provider> | ||
); | ||
} | ||
|
||
export function useBudgetMonthCount() { | ||
return useContext(BudgetMonthCountContext); | ||
} |
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,6 @@ | ||
--- | ||
category: Maintenance | ||
authors: [Jod929] | ||
--- | ||
|
||
Refactor budget/BudgetMonthCountContext to tsx. |