diff --git a/src/App.tsx b/src/App.tsx index f3c33e9f9..3d5523c04 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,14 +5,14 @@ import { toast, ToastContainer } from 'react-toastify' import { EnvironmentConfig } from './config' import { Header } from './header' import { analyticsInitialize, logInitialize, ProfileProvider } from './lib' -import { RouteContext, RouteContextData } from './lib/route-provider' +import { routeContext, RouteContextData } from './lib/route-provider' analyticsInitialize(EnvironmentConfig) logInitialize(EnvironmentConfig) const App: FC<{}> = () => { - const { allRoutes }: RouteContextData = useContext(RouteContext) + const { allRoutes }: RouteContextData = useContext(routeContext) const routeElements: Array = allRoutes .map(route => { diff --git a/src/header/tool-selectors/tool-selectors-narrow/ToolSelectorsNarrow.tsx b/src/header/tool-selectors/tool-selectors-narrow/ToolSelectorsNarrow.tsx index fc2ca6650..424f76a53 100644 --- a/src/header/tool-selectors/tool-selectors-narrow/ToolSelectorsNarrow.tsx +++ b/src/header/tool-selectors/tool-selectors-narrow/ToolSelectorsNarrow.tsx @@ -1,14 +1,14 @@ import classNames from 'classnames' import { Dispatch, FC, SetStateAction, useContext, useState } from 'react' -import { IconOutline, RouteContext, RouteContextData } from '../../../lib' +import { IconOutline, routeContext, RouteContextData } from '../../../lib' import { ToolSelectorNarrow } from './tool-selector-narrow' import styles from './ToolSelectorsNarrow.module.scss' const ToolSelectorsNarrow: FC<{}> = () => { - const { toolsRoutes }: RouteContextData = useContext(RouteContext) + const { toolsRoutes }: RouteContextData = useContext(routeContext) const [isOpen, setIsOpen]: [boolean, Dispatch>] = useState(false) const closed: JSX.Element = diff --git a/src/header/tool-selectors/tool-selectors-wide/ToolSelectorsWide.tsx b/src/header/tool-selectors/tool-selectors-wide/ToolSelectorsWide.tsx index e36f2d6ca..7a499706b 100644 --- a/src/header/tool-selectors/tool-selectors-wide/ToolSelectorsWide.tsx +++ b/src/header/tool-selectors/tool-selectors-wide/ToolSelectorsWide.tsx @@ -1,13 +1,13 @@ import { FC, useContext } from 'react' -import { RouteContext, RouteContextData } from '../../../lib' +import { routeContext, RouteContextData } from '../../../lib' import { ToolSelectorWide } from './tool-selector-wide' import styles from './ToolSelectorsWide.module.scss' const ToolSelectorsWide: FC<{}> = () => { - const { toolsRoutes }: RouteContextData = useContext(RouteContext) + const { toolsRoutes }: RouteContextData = useContext(routeContext) const selectors: Array = toolsRoutes .map(route => ) diff --git a/src/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx b/src/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx index a5196bb1c..30d2c951a 100644 --- a/src/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx +++ b/src/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx @@ -23,7 +23,7 @@ const ToolSelectorWide: FC = (props: ToolSelectorWideProp {title} diff --git a/src/header/utility-selectors/UtilitySelector/ProfileSelector/ProfileSelector.tsx b/src/header/utility-selectors/UtilitySelector/ProfileSelector/ProfileSelector.tsx index 6dad37823..6758ec4f7 100644 --- a/src/header/utility-selectors/UtilitySelector/ProfileSelector/ProfileSelector.tsx +++ b/src/header/utility-selectors/UtilitySelector/ProfileSelector/ProfileSelector.tsx @@ -1,6 +1,6 @@ import { FC, useContext } from 'react' -import { ProfileContext, ProfileContextData } from '../../../../lib' +import { profileContext, ProfileContextData } from '../../../../lib' import '../../../../lib/styles/index.scss' import { ProfileLoggedIn } from './profile-logged-in' @@ -12,7 +12,7 @@ const ProfileSelector: FC<{}> = () => { const { initialized, profile, - }: ProfileContextData = useContext(ProfileContext) + }: ProfileContextData = useContext(profileContext) // if we're not initialized, don't render anything if (!initialized) { diff --git a/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx b/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx index 6a14a8a17..ebb5ce73d 100644 --- a/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx +++ b/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx @@ -1,13 +1,19 @@ import { Dispatch, FC, SetStateAction, useContext, useState } from 'react' -import { Avatar, IconOutline, logInfo , ProfileContext, ProfileContextData } from '../../../../../lib' +import { + Avatar, + IconOutline, + logInfo, + profileContext, + ProfileContextData, +} from '../../../../../lib' import { ProfilePanel } from './profile-panel' import styles from './ProfileLoggedIn.module.scss' const ProfileLoggedIn: FC<{}> = () => { - const { profile }: ProfileContextData = useContext(ProfileContext) + const { profile }: ProfileContextData = useContext(profileContext) const [profilePanelOpen, setProfilePanelOpen]: [boolean, Dispatch>] = useState(false) if (!profile) { diff --git a/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx b/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx index 0bbba8827..79719e486 100644 --- a/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx +++ b/src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx @@ -3,9 +3,9 @@ import { Link } from 'react-router-dom' import { authUrlLogout, - ProfileContext, + profileContext, ProfileContextData, - RouteContext, + routeContext, RouteContextData, } from '../../../../../../lib' @@ -17,8 +17,8 @@ interface ProfilePanelProps { const ProfilePanel: FC = (props: ProfilePanelProps) => { - const { profile }: ProfileContextData = useContext(ProfileContext) - const { getPath }: RouteContextData = useContext(RouteContext) + const { profile }: ProfileContextData = useContext(profileContext) + const { getPath }: RouteContextData = useContext(routeContext) if (!profile) { // this should never happen diff --git a/src/lib/button/Button.tsx b/src/lib/button/Button.tsx index 5a5e69e2b..c2d406360 100644 --- a/src/lib/button/Button.tsx +++ b/src/lib/button/Button.tsx @@ -4,16 +4,20 @@ import { Link } from 'react-router-dom' import styles from './Button.module.scss' -interface ButtonProps { - readonly buttonStyle?: 'primary' | 'secondary' | 'tertiary' | 'text' +export type ButtonSize = 'sm' | 'md' | 'lg' | 'xl' +export type ButtonStyle = 'primary' | 'secondary' | 'tertiary' | 'text' +export type ButtonType = 'button' | 'submit' + +export interface ButtonProps { + readonly buttonStyle?: ButtonStyle readonly className?: string readonly disable?: boolean readonly label: string readonly onClick?: (event?: any) => void readonly route?: string - readonly size?: 'sm' | 'md' | 'lg' | 'xl' + readonly size?: ButtonSize readonly tabIndex: number - readonly type?: 'button' | 'submit' + readonly type?: ButtonType readonly url?: string } diff --git a/src/lib/button/Buttons.test.tsx b/src/lib/button/Buttons.test.tsx new file mode 100644 index 000000000..0dae599ff --- /dev/null +++ b/src/lib/button/Buttons.test.tsx @@ -0,0 +1,6 @@ +import '@testing-library/jest-dom' + +describe('