Skip to content

Commit

Permalink
Merge pull request #179 from TClark1011:fix/remembered-sheets-mobile-…
Browse files Browse the repository at this point in the history
…layout

Fix/remembered-sheets-mobile-layout
  • Loading branch information
TClark1011 authored Jun 23, 2023
2 parents 5e3c56f + 9bc6280 commit 904edcf
Show file tree
Hide file tree
Showing 12 changed files with 321 additions and 185 deletions.
4 changes: 2 additions & 2 deletions src/components/domain/PageContentContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Box } from "@chakra-ui/react";
import { Container } from "@chakra-ui/react";
import React, { PropsWithChildren } from "react";

/**
* Wrap the content of pages like 'info' and 'contact'
* and apply consistent horizontal padding
*/
const PageContentContainer: React.FC<PropsWithChildren> = ({ children }) => (
<Box paddingX={[0, 16, 32, 64, 96]}>{children}</Box>
<Container centerContent>{children}</Container>
);

export default PageContentContainer;
2 changes: 1 addition & 1 deletion src/components/templates/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const View: React.FC<ViewProps> = ({
showTopNav = true,
showHomeLink = true,
minFullHeight = true,
accountForTopNav = showTopNav,
accountForTopNav = showTopNav, // adds padding to top of content to account for top nav
children,
...metaProps
}) => {
Expand Down
2 changes: 0 additions & 2 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export { default as theme } from "./theme";

export * from "./env";
export * from "./publicEnv";
export * from "./options";
119 changes: 0 additions & 119 deletions src/config/theme.ts

This file was deleted.

73 changes: 73 additions & 0 deletions src/lib/global-loader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import {
Modal,
ModalContent,
ModalOverlay,
Spinner,
Text,
} from "@chakra-ui/react";
import { atom, useAtomValue, useSetAtom } from "jotai";
import { FC, useEffect } from "react";

const isGlobalLoadingAtom = atom(false);
const globalLoadingMessageAtom = atom<string | undefined>(undefined);

/**
* To use this, just call `useGlobalLoading` in your component,
* passing in a boolean for whether or not the global loader should
* be shown and an optional message to display.
*/
export const useGlobalLoading = (isLoading: boolean, message?: string) => {
const setIsLoading = useSetAtom(isGlobalLoadingAtom);
const setMessage = useSetAtom(globalLoadingMessageAtom);

useEffect(() => {
setIsLoading(isLoading);
setMessage(message);
}, [isLoading, message, setIsLoading, setMessage]);

useEffect(() => {
return () => {
setIsLoading(false);
setMessage(undefined);
};
}, [setIsLoading, setMessage]);
};

/**
* Place this in your `_app.tsx` file
*/
export const GlobalLoader: FC = () => {
const isLoading = useAtomValue(isGlobalLoadingAtom);
const message = useAtomValue(globalLoadingMessageAtom);

return (
<Modal
isOpen={isLoading}
onClose={() => {}}
closeOnOverlayClick={false}
isCentered
autoFocus={false}
>
<ModalOverlay />
<ModalContent
bg="transparent"
border="none"
display="flex"
flexDirection="column"
alignItems="center"
>
<Spinner
size="xl"
emptyColor="gray.200"
color="primary.500"
thickness="4px"
/>
{message && (
<Text fontWeight="bold" mt="group">
{message}
</Text>
)}
</ModalContent>
</Modal>
);
};
5 changes: 4 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChakraProvider, ColorModeScript } from "@chakra-ui/react";
import React from "react";
import { IN_DEV, IN_PREVIEW, theme } from "$root/config";
import { IN_DEV, IN_PREVIEW } from "$root/config";
import Head from "next/head";
import { appName } from "$root/constants";
import { Meta } from "$root/components";
Expand All @@ -17,6 +17,8 @@ import queries from "$root/hooks/queries";

import { Analytics } from "@vercel/analytics/react";
import { match } from "ts-pattern";
import { GlobalLoader } from "$global-loader";
import theme from "$root/theme/theme";

/**
* Generate a selector to add a background color
Expand Down Expand Up @@ -86,6 +88,7 @@ const MyApp = ({ Component, pageProps }: AppProps): React.ReactElement => {
`}
/>
<Component {...pageProps} />
<GlobalLoader />
<Analytics
debug={IN_DEV || IN_PREVIEW}
beforeSend={({ url, ...event }) => {
Expand Down
Loading

1 comment on commit 904edcf

@vercel
Copy link

@vercel vercel bot commented on 904edcf Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.