Skip to content

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

Use fixed height in card title component

dominik-zeglenf654350302f4
diff --git a/saleor/static/dashboard-next/components/CardTitle/CardTitle.tsx b/saleor/static/dashboard-next/components/CardTitle/CardTitle.tsx
index aece856423..69ff58f636 100644
--- a/saleor/static/dashboard-next/components/CardTitle/CardTitle.tsx
+++ b/saleor/static/dashboard-next/components/CardTitle/CardTitle.tsx
@@ -11,6 +11,9 @@ import * as React from "react";
const styles = (theme: Theme) =>
createStyles({
children: theme.mixins.gutters({}),
+ constantHeight: {
+ height: 48
+ },
hr: {
backgroundColor: "#eaeaea",
border: "none",
@@ -39,6 +42,7 @@ const styles = (theme: Theme) =>
interface CardTitleProps extends WithStyles<typeof styles> {
children?: React.ReactNode;
className?: string;
+ height?: "default" | "const";
title: string | React.ReactNode;
toolbar?: React.ReactNode;
onClick?: (event: React.MouseEvent<any>) => void;
@@ -49,13 +53,21 @@ const CardTitle = withStyles(styles, { name: "CardTitle" })(
classes,
className,
children,
+ height,
title,
toolbar,
onClick,
...props
}: CardTitleProps) => (
<>
- <div className={classNames(classes.root, className)} {...props}>
+ <div
+ className={classNames({
+ [classes.root]: true,
+ [className]: !!className,
+ [classes.constantHeight]: height === "const"
+ })}
+ {...props}
+ >
<Typography
className={classes.title}
variant="body1"
diff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
index f43c1d5b9a..ec580d6e60 100644
--- a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
@@ -54,6 +54,7 @@ const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(
}: ShippingZonesListProps & WithStyles<typeof styles>) => (
<Card>
<CardTitle
+ height="const"
title={i18n.t("Shipping by zone")}
toolbar={
<Button color="secondary" onClick={onAdd}>
diff --git a/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx b/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx
index 6f6ef63611..1dadaa6657 100644
--- a/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx
@@ -13,7 +13,6 @@ const props: ShippingZonesListPageProps = {
...pageListProps.default,
defaultWeightUnit: WeightUnitsEnum.kg,
onAdd: () => undefined,
- onBack: () => undefined,
onRemove: () => undefined,
onSubmit: () => undefined,
shippingZones