Fix product assign styling
This commit is contained in:
parent
fb0a503b91
commit
3df64beb59
2 changed files with 21 additions and 21 deletions
|
@ -114,7 +114,10 @@ const AssignCollectionDialog: React.FC<AssignCollectionDialogProps> = props => {
|
||||||
description="dialog header"
|
description="dialog header"
|
||||||
/>
|
/>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogContent className={scrollableDialogClasses.content}>
|
<DialogContent
|
||||||
|
className={scrollableDialogClasses.content}
|
||||||
|
ref={container}
|
||||||
|
>
|
||||||
<TextField
|
<TextField
|
||||||
name="query"
|
name="query"
|
||||||
value={query}
|
value={query}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import useSearchQuery from "@saleor/hooks/useSearchQuery";
|
||||||
import { buttonMessages } from "@saleor/intl";
|
import { buttonMessages } from "@saleor/intl";
|
||||||
import { maybe } from "@saleor/misc";
|
import { maybe } from "@saleor/misc";
|
||||||
import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts";
|
import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts";
|
||||||
|
import useScrollableDialogStyle from "@saleor/styles/useScrollableDialogStyle";
|
||||||
import { FetchMoreProps } from "@saleor/types";
|
import { FetchMoreProps } from "@saleor/types";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import InfiniteScroll from "react-infinite-scroller";
|
import InfiniteScroll from "react-infinite-scroller";
|
||||||
|
@ -32,7 +33,7 @@ export interface FormData {
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
theme => ({
|
{
|
||||||
avatar: {
|
avatar: {
|
||||||
"&&:first-child": {
|
"&&:first-child": {
|
||||||
paddingLeft: 0
|
paddingLeft: 0
|
||||||
|
@ -45,22 +46,8 @@ const useStyles = makeStyles(
|
||||||
},
|
},
|
||||||
colName: {
|
colName: {
|
||||||
paddingLeft: 0
|
paddingLeft: 0
|
||||||
},
|
|
||||||
loadMoreLoaderContainer: {
|
|
||||||
alignItems: "center",
|
|
||||||
display: "flex",
|
|
||||||
height: theme.spacing(3),
|
|
||||||
justifyContent: "center",
|
|
||||||
marginTop: theme.spacing(3)
|
|
||||||
},
|
|
||||||
overflow: {
|
|
||||||
overflowY: "visible"
|
|
||||||
},
|
|
||||||
scrollArea: {
|
|
||||||
height: 500,
|
|
||||||
overflowY: "scroll"
|
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
{ name: "AssignProductDialog" }
|
{ name: "AssignProductDialog" }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -104,20 +91,24 @@ const AssignProductDialog: React.FC<AssignProductDialogProps> = props => {
|
||||||
onSubmit
|
onSubmit
|
||||||
} = props;
|
} = props;
|
||||||
const classes = useStyles(props);
|
const classes = useStyles(props);
|
||||||
|
const scrollableDialogClasses = useScrollableDialogStyle({});
|
||||||
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [query, onQueryChange] = useSearchQuery(onFetch);
|
const [query, onQueryChange] = useSearchQuery(onFetch);
|
||||||
const [selectedProducts, setSelectedProducts] = React.useState<
|
const [selectedProducts, setSelectedProducts] = React.useState<
|
||||||
SearchProducts_search_edges_node[]
|
SearchProducts_search_edges_node[]
|
||||||
>([]);
|
>([]);
|
||||||
|
const container = React.useRef<HTMLDivElement>();
|
||||||
|
|
||||||
const handleSubmit = () => onSubmit(selectedProducts);
|
const handleSubmit = () => onSubmit(selectedProducts);
|
||||||
|
|
||||||
|
const containerHeight = container.current?.scrollHeight - 130;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
open={open}
|
open={open}
|
||||||
classes={{ paper: classes.overflow }}
|
classes={{ paper: scrollableDialogClasses.dialog }}
|
||||||
fullWidth
|
fullWidth
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
>
|
>
|
||||||
|
@ -127,7 +118,10 @@ const AssignProductDialog: React.FC<AssignProductDialogProps> = props => {
|
||||||
description="dialog header"
|
description="dialog header"
|
||||||
/>
|
/>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent
|
||||||
|
className={scrollableDialogClasses.content}
|
||||||
|
ref={container}
|
||||||
|
>
|
||||||
<TextField
|
<TextField
|
||||||
name="query"
|
name="query"
|
||||||
value={query}
|
value={query}
|
||||||
|
@ -146,14 +140,17 @@ const AssignProductDialog: React.FC<AssignProductDialogProps> = props => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<FormSpacer />
|
<FormSpacer />
|
||||||
<div className={classes.scrollArea}>
|
<div
|
||||||
|
className={scrollableDialogClasses.scrollArea}
|
||||||
|
style={{ height: containerHeight }}
|
||||||
|
>
|
||||||
<InfiniteScroll
|
<InfiniteScroll
|
||||||
pageStart={0}
|
pageStart={0}
|
||||||
loadMore={onFetchMore}
|
loadMore={onFetchMore}
|
||||||
hasMore={hasMore}
|
hasMore={hasMore}
|
||||||
useWindow={false}
|
useWindow={false}
|
||||||
loader={
|
loader={
|
||||||
<div className={classes.loadMoreLoaderContainer}>
|
<div className={scrollableDialogClasses.loadMoreLoaderContainer}>
|
||||||
<CircularProgress size={16} />
|
<CircularProgress size={16} />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue