-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
27,109 additions
and
13,901 deletions.
There are no files selected for viewing
Binary file modified
BIN
+235 Bytes
(110%)
pkg/samplerepo/assets/sample/images/quickstart-step-00-launch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+195 Bytes
(110%)
pkg/samplerepo/assets/sample/images/quickstart-step-01-query.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+23 Bytes
(100%)
pkg/samplerepo/assets/sample/images/quickstart-step-02-branch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+111 Bytes
(100%)
pkg/samplerepo/assets/sample/images/quickstart-step-03-merge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+82 Bytes
(100%)
pkg/samplerepo/assets/sample/images/quickstart-step-04-rollback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.07 KB
(77%)
pkg/samplerepo/assets/sample/images/quickstart-step-05-actions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
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,26 @@ | ||
import React, {FC, useContext} from "react"; | ||
import {DarkModeSwitch} from "react-toggle-dark-mode"; | ||
import {AppActionType, AppContext} from "../hooks/appContext"; | ||
|
||
const DarkModeToggle: FC = () => { | ||
const {state, dispatch} = useContext(AppContext); | ||
|
||
const toggleDarkMode = (isOn: boolean) => { | ||
dispatch({ | ||
type: AppActionType.setDarkMode, | ||
value: isOn, | ||
}); | ||
}; | ||
|
||
return ( | ||
<DarkModeSwitch | ||
style={{marginRight: '2rem'}} | ||
checked={state.settings.darkMode} | ||
onChange={toggleDarkMode} | ||
size={28} | ||
sunColor={"white"} | ||
/> | ||
); | ||
}; | ||
|
||
export default DarkModeToggle; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { createContext, useReducer } from "react"; | ||
|
||
type AppContextType = { | ||
settings: AppContext; | ||
}; | ||
|
||
type AppContext = { | ||
darkMode: boolean; | ||
}; | ||
|
||
const localStorageKeys = { | ||
darkMode: 'darkMode', | ||
}; | ||
|
||
enum AppActionType { | ||
setDarkMode = 'setDarkMode', | ||
} | ||
|
||
interface Action { | ||
type: AppActionType; | ||
value: boolean; | ||
} | ||
|
||
const initialLocalSettings: AppContext = { | ||
darkMode: window.localStorage.getItem(localStorageKeys.darkMode) === String(true), | ||
}; | ||
|
||
const initialAppContext: AppContextType = { | ||
settings: initialLocalSettings, | ||
}; | ||
|
||
const appContextReducer = (state: AppContextType, action: Action) => { | ||
switch (action.type) { | ||
case AppActionType.setDarkMode: | ||
window.localStorage.setItem(localStorageKeys.darkMode, String(action.value)); | ||
return {...state, settings: {...state.settings, darkMode: action.value}}; | ||
default: | ||
return state; | ||
} | ||
} | ||
|
||
type ContextType = { | ||
state: AppContextType, | ||
dispatch: React.Dispatch<Action>, | ||
}; | ||
|
||
const AppContext = createContext<ContextType>({ | ||
state: initialAppContext, | ||
dispatch: () => null | ||
}); | ||
|
||
// @ts-expect-error - it doesn't like the "children" prop | ||
const WithAppContext: React.FC = ({children}) => { | ||
const [state, dispatch] = useReducer(appContextReducer, initialAppContext); | ||
|
||
return ( | ||
<AppContext.Provider value={{state, dispatch}}> | ||
{children} | ||
</AppContext.Provider> | ||
) | ||
} | ||
|
||
export { WithAppContext, AppContext, AppActionType }; |
Oops, something went wrong.