Make content cards not sticky, for better support of smaller screens (#148)
* [Invoices] Remove sticky containers for better support of small screens * Change loader to be circular instead linear
This commit is contained in:
parent
846ad44d89
commit
c1dab0ba18
5 changed files with 39 additions and 9 deletions
5
.changeset/thick-singers-mate.md
Normal file
5
.changeset/thick-singers-mate.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"saleor-app-invoices": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Unsticky app cards and change loader type
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -38,4 +38,6 @@ yarn-error.log*
|
||||||
.saleor-app-auth.json
|
.saleor-app-auth.json
|
||||||
test-invoice.pdf
|
test-invoice.pdf
|
||||||
coverage/
|
coverage/
|
||||||
apps/**/generated
|
apps/**/generated
|
||||||
|
|
||||||
|
.eslintcache
|
|
@ -8,18 +8,17 @@ import { ChannelsList } from "./channels-list";
|
||||||
import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
import { actions, useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
import { AppColumnsLayout } from "../../ui/app-columns-layout";
|
import { AppColumnsLayout } from "../../ui/app-columns-layout";
|
||||||
import { TitleBar } from "@saleor/apps-shared";
|
import { TitleBar } from "@saleor/apps-shared";
|
||||||
|
import { Loader } from "../../ui/loader";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => {
|
const useStyles = makeStyles((theme) => {
|
||||||
return {
|
return {
|
||||||
header: { marginBottom: 20 },
|
header: { marginBottom: 20 },
|
||||||
grid: { display: "grid", gridTemplateColumns: "1fr 1fr", alignItems: "start", gap: 40 },
|
grid: { display: "grid", gridTemplateColumns: "1fr 1fr", alignItems: "start", gap: 40 },
|
||||||
formContainer: {
|
formContainer: {
|
||||||
top: TitleBar.height + 16,
|
marginTop: 12,
|
||||||
position: "sticky",
|
|
||||||
},
|
},
|
||||||
instructionsContainer: {
|
instructionsContainer: {
|
||||||
top: TitleBar.height + 16,
|
marginTop: 12,
|
||||||
position: "sticky",
|
|
||||||
padding: 15,
|
padding: 15,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -64,7 +63,7 @@ export const ChannelsConfiguration = () => {
|
||||||
}, [channels.data, activeChannelSlug]);
|
}, [channels.data, activeChannelSlug]);
|
||||||
|
|
||||||
if (channels.isLoading || !channels.data) {
|
if (channels.isLoading || !channels.data) {
|
||||||
return <LinearProgress />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!activeChannel) {
|
if (!activeChannel) {
|
||||||
|
@ -76,7 +75,10 @@ export const ChannelsConfiguration = () => {
|
||||||
<ChannelsList
|
<ChannelsList
|
||||||
channels={channels.data}
|
channels={channels.data}
|
||||||
activeChannelSlug={activeChannel.slug}
|
activeChannelSlug={activeChannel.slug}
|
||||||
onChannelClick={setActiveChannelSlug}
|
onChannelClick={(slug) => {
|
||||||
|
setActiveChannelSlug(slug);
|
||||||
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{activeChannel ? (
|
{activeChannel ? (
|
||||||
|
|
21
apps/invoices/src/modules/ui/loader.tsx
Normal file
21
apps/invoices/src/modules/ui/loader.tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { CircularProgress } from "@material-ui/core";
|
||||||
|
import { makeStyles } from "@saleor/macaw-ui";
|
||||||
|
|
||||||
|
const useStyles = makeStyles({
|
||||||
|
root: {
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
height: 300,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const Loader = () => {
|
||||||
|
const styles = useStyles();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.root}>
|
||||||
|
<CircularProgress color="primary" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
|
@ -3,8 +3,8 @@ import { useAppBridge } from "@saleor/app-sdk/app-bridge";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useIsMounted } from "usehooks-ts";
|
import { useIsMounted } from "usehooks-ts";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { LinearProgress } from "@material-ui/core";
|
|
||||||
import { isInIframe } from "@saleor/apps-shared";
|
import { isInIframe } from "@saleor/apps-shared";
|
||||||
|
import { Loader } from "../modules/ui/loader";
|
||||||
|
|
||||||
const IndexPage: NextPage = () => {
|
const IndexPage: NextPage = () => {
|
||||||
const { appBridgeState } = useAppBridge();
|
const { appBridgeState } = useAppBridge();
|
||||||
|
@ -18,7 +18,7 @@ const IndexPage: NextPage = () => {
|
||||||
}, [isMounted, appBridgeState?.ready]);
|
}, [isMounted, appBridgeState?.ready]);
|
||||||
|
|
||||||
if (isInIframe()) {
|
if (isInIframe()) {
|
||||||
return <LinearProgress />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue