Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use grid component

dominik-zeglen13eb3e33c6a7
diff --git a/saleor/static/dashboard-next/taxes/components/CountryListPage/CountryListPage.tsx b/saleor/static/dashboard-next/taxes/components/CountryListPage/CountryListPage.tsx
index 5523837299..a83e0e626a 100644
--- a/saleor/static/dashboard-next/taxes/components/CountryListPage/CountryListPage.tsx
+++ b/saleor/static/dashboard-next/taxes/components/CountryListPage/CountryListPage.tsx
@@ -1,13 +1,8 @@
-import {
- createStyles,
- Theme,
- withStyles,
- WithStyles
-} from "@material-ui/core/styles";
import * as React from "react";
import { Container } from "../../../components/Container";
import Form from "../../../components/Form";
+import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
@@ -15,15 +10,6 @@ import { CountryList_shop } from "../../types/CountryList";
import CountryList from "../CountryList";
import TaxConfiguration from "../TaxConfiguration";
-const styles = (theme: Theme) =>
- createStyles({
- root: {
- display: "grid",
- gridColumnGap: theme.spacing.unit * 2 + "px",
- gridTemplateColumns: "9fr 4fr"
- }
- });
-
export interface FormData {
includeTax: boolean;
showGross: boolean;
@@ -37,46 +23,43 @@ export interface CountryListPageProps {
onTaxFetch: () => void;
}
-const CountryListPage = withStyles(styles, { name: "CountryListPage" })(
- ({
- classes,
- disabled,
- shop,
- onRowClick,
- onSubmit,
- onTaxFetch
- }: CountryListPageProps & WithStyles<typeof styles>) => {
- const initialForm: FormData = {
- chargeTaxesOnShipping: maybe(() => shop.chargeTaxesOnShipping, false),
- includeTax: maybe(() => shop.includeTaxesInPrices, false),
- showGross: maybe(() => shop.displayGrossPrices, false)
- };
- return (
- <Form initial={initialForm} onSubmit={onSubmit}>
- {({ change, data, submit }) => (
- <Container width="md">
- <PageHeader title={i18n.t("Taxes", { context: "page title" })} />
- <div className={classes.root}>
- <div>
- <CountryList
- countries={maybe(() => shop.countries)}
- onRowClick={onRowClick}
- />
- </div>
- <div>
- <TaxConfiguration
- data={data}
- disabled={disabled}
- onChange={event => change(event, submit)}
- onTaxFetch={onTaxFetch}
- />
- </div>
+const CountryListPage: React.StatelessComponent<CountryListPageProps> = ({
+ disabled,
+ shop,
+ onRowClick,
+ onSubmit,
+ onTaxFetch
+}) => {
+ const initialForm: FormData = {
+ chargeTaxesOnShipping: maybe(() => shop.chargeTaxesOnShipping, false),
+ includeTax: maybe(() => shop.includeTaxesInPrices, false),
+ showGross: maybe(() => shop.displayGrossPrices, false)
+ };
+ return (
+ <Form initial={initialForm} onSubmit={onSubmit}>
+ {({ change, data, submit }) => (
+ <Container width="md">
+ <PageHeader title={i18n.t("Taxes", { context: "page title" })} />
+ <Grid>
+ <div>
+ <CountryList
+ countries={maybe(() => shop.countries)}
+ onRowClick={onRowClick}
+ />
+ </div>
+ <div>
+ <TaxConfiguration
+ data={data}
+ disabled={disabled}
+ onChange={event => change(event, submit)}
+ onTaxFetch={onTaxFetch}
+ />
</div>
- </Container>
- )}
- </Form>
- );
- }
-);
+ </Grid>
+ </Container>
+ )}
+ </Form>
+ );
+};
CountryListPage.displayName = "CountryListPage";
export default CountryListPage;
diff --git a/saleor/static/dashboard-next/taxes/components/CountryTaxesPage/CountryTaxesPage.tsx b/saleor/static/dashboard-next/taxes/components/CountryTaxesPage/CountryTaxesPage.tsx
index 3b3b508ed6..635086c1b8 100644
--- a/saleor/static/dashboard-next/taxes/components/CountryTaxesPage/CountryTaxesPage.tsx
+++ b/saleor/static/dashboard-next/taxes/components/CountryTaxesPage/CountryTaxesPage.tsx
@@ -13,23 +13,18 @@ import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
import { Container } from "../../../components/Container";
+import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import Skeleton from "../../../components/Skeleton";
import i18n from "../../../i18n";
import { maybe, renderCollection, translatedTaxRates } from "../../../misc";
import { CountryList_shop_countries_vat_reducedRates } from "../../types/CountryList";
-const styles = (theme: Theme) =>
- createStyles({
- root: {
- display: "grid",
- gridColumnGap: theme.spacing.unit * 2 + "px",
- gridTemplateColumns: "9fr 4fr"
- },
- wideColumn: {
- width: "80%"
- }
- });
+const styles = createStyles({
+ wideColumn: {
+ width: "80%"
+ }
+});
export interface CountryTaxesPageProps {
countryName: string;
@@ -58,7 +53,7 @@ const CountryTaxesPage = withStyles(styles, { name: "CountryTaxesPage" })(
}
onBack={onBack}
/>
- <div className={classes.root}>
+ <Grid>
<div>
<Card>
<Table>
@@ -105,7 +100,7 @@ const CountryTaxesPage = withStyles(styles, { name: "CountryTaxesPage" })(
</Table>
</Card>
</div>
- </div>
+ </Grid>
</Container>
);
}