Apply prettier over all files

This commit is contained in:
Luis Alvarez
2020-10-01 20:40:40 -05:00
parent 2314ad760a
commit 0ef6449aff
72 changed files with 648 additions and 652 deletions

View File

@@ -1,56 +1,56 @@
import React, { FunctionComponent } from "react";
import React, { FunctionComponent } from 'react'
export interface UIState {
displaySidebar: boolean;
openSidebar: () => {};
closeSidebar: () => {};
displaySidebar: boolean
openSidebar: () => {}
closeSidebar: () => {}
}
const initialState = {
displaySidebar: false,
openSidebar: null,
closeSidebar: null,
};
}
export const UIContext = React.createContext(initialState);
UIContext.displayName = "UIContext";
export const UIContext = React.createContext(initialState)
UIContext.displayName = 'UIContext'
export const UIProvider: FunctionComponent = (props) => {
const [state, dispatch] = React.useReducer(uiReducer, initialState);
const [state, dispatch] = React.useReducer(uiReducer, initialState)
const openSidebar = () => dispatch("OPEN_SIDEBAR");
const closeSidebar = () => dispatch("CLOSE_SIDEBAR");
const openSidebar = () => dispatch('OPEN_SIDEBAR')
const closeSidebar = () => dispatch('CLOSE_SIDEBAR')
const value = {
...state,
openSidebar,
closeSidebar,
};
}
return <UIContext.Provider value={value} {...props} />;
};
return <UIContext.Provider value={value} {...props} />
}
export const useUI = () => {
const context = React.useContext(UIContext);
const context = React.useContext(UIContext)
if (context === undefined) {
throw new Error(`useUI must be used within a UIProvider`);
throw new Error(`useUI must be used within a UIProvider`)
}
return context;
};
return context
}
function uiReducer(state, action) {
switch (action) {
case "OPEN_SIDEBAR": {
case 'OPEN_SIDEBAR': {
return {
...state,
displaySidebar: true,
};
}
}
case "CLOSE_SIDEBAR": {
case 'CLOSE_SIDEBAR': {
return {
...state,
displaySidebar: false,
};
}
}
}
}