-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: UI page layout component nesting and move app context to re…
…dux (#265) * refactor: remove app context to use redux instead * refactor: gradient overlay to single element * refactor: app state backgroundColor to overlayColor * refactor: app page nesting and positioning
- Loading branch information
Showing
14 changed files
with
101 additions
and
92 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useAppStore } from '@/store'; | ||
|
||
import { PageStyles as PS } from './page.styles'; | ||
|
||
export const GradientOverlay: React.FC = () => { | ||
const { overlayColor } = useAppStore(); | ||
|
||
if (!overlayColor) return null; | ||
|
||
return ( | ||
<PS.GradientOverlay | ||
css={{ | ||
background: `linear-gradient(180deg, #${overlayColor}59 0%, transparent 30%)`, | ||
}} | ||
/> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'; | ||
|
||
import { RootState } from '@/store'; | ||
import { useAppSelector } from '@/store/hooks'; | ||
|
||
export interface AppState { | ||
overlayColor?: string; | ||
} | ||
|
||
const initialState: AppState = { | ||
overlayColor: undefined, | ||
}; | ||
|
||
export const appSlice = createSlice({ | ||
name: 'AppSlice', | ||
initialState, | ||
reducers: { | ||
setOverlayColor: (state, action: PayloadAction<string>) => { | ||
state.overlayColor = action.payload; | ||
}, | ||
clearOverlayColor: (state) => { | ||
state.overlayColor = undefined; | ||
}, | ||
}, | ||
}); | ||
|
||
export const appActions = appSlice.actions; | ||
|
||
const selectAppState = (state: RootState): AppState => state.app; | ||
|
||
export const useAppStore = (): AppState => useAppSelector(selectAppState); | ||
|
||
export default appSlice.reducer; |
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 @@ | ||
export * from './app-slice'; |
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
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