Change ExpansionPanel as Accordion (#1279)
* Fix variant creation - remove channels + prices * Update messages and snapshots * Change ExpansionPanel as Accordion * Update snapshots Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
This commit is contained in:
parent
c6cfb2ecc9
commit
feef026fd0
9 changed files with 330 additions and 341 deletions
|
@ -1,8 +1,4 @@
|
||||||
import {
|
import { Accordion, AccordionSummary, Typography } from "@material-ui/core";
|
||||||
ExpansionPanel,
|
|
||||||
ExpansionPanelSummary,
|
|
||||||
Typography
|
|
||||||
} from "@material-ui/core";
|
|
||||||
import { ChannelData } from "@saleor/channels/utils";
|
import { ChannelData } from "@saleor/channels/utils";
|
||||||
import { Messages } from "@saleor/components/ChannelsAvailabilityCard/types";
|
import { Messages } from "@saleor/components/ChannelsAvailabilityCard/types";
|
||||||
import IconChevronDown from "@saleor/icons/ChevronDown";
|
import IconChevronDown from "@saleor/icons/ChevronDown";
|
||||||
|
@ -119,8 +115,8 @@ const ChannelWithVariantsAvailabilityItemWrapper: React.FC<ChannelAvailabilityIt
|
||||||
: messages.variantCountLabel;
|
: messages.variantCountLabel;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ExpansionPanel classes={expanderClasses}>
|
<Accordion classes={expanderClasses}>
|
||||||
<ExpansionPanelSummary
|
<AccordionSummary
|
||||||
expandIcon={<IconChevronDown />}
|
expandIcon={<IconChevronDown />}
|
||||||
classes={summaryClasses}
|
classes={summaryClasses}
|
||||||
>
|
>
|
||||||
|
@ -129,9 +125,9 @@ const ChannelWithVariantsAvailabilityItemWrapper: React.FC<ChannelAvailabilityIt
|
||||||
<Label text={intl.formatMessage(variantsLabel, { variantsCount })} />
|
<Label text={intl.formatMessage(variantsLabel, { variantsCount })} />
|
||||||
<Label text={commonChannelMessages.availableDateText} />
|
<Label text={commonChannelMessages.availableDateText} />
|
||||||
</div>
|
</div>
|
||||||
</ExpansionPanelSummary>
|
</AccordionSummary>
|
||||||
{children}
|
{children}
|
||||||
</ExpansionPanel>
|
</Accordion>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import placeholderImage from "@assets/images/placeholder60x60.png";
|
import placeholderImage from "@assets/images/placeholder60x60.png";
|
||||||
import {
|
import {
|
||||||
|
Accordion,
|
||||||
|
AccordionSummary,
|
||||||
Divider,
|
Divider,
|
||||||
ExpansionPanel,
|
|
||||||
ExpansionPanelSummary,
|
|
||||||
Typography
|
Typography
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { ChannelData } from "@saleor/channels/utils";
|
import { ChannelData } from "@saleor/channels/utils";
|
||||||
|
@ -155,12 +155,12 @@ const ChannelsWithVariantsAvailabilityDialogContent: React.FC<ChannelsWithVarian
|
||||||
placeholderImage;
|
placeholderImage;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ExpansionPanel
|
<Accordion
|
||||||
classes={expanderClasses}
|
classes={expanderClasses}
|
||||||
data-test-id="expand-channel-row"
|
data-test-id="expand-channel-row"
|
||||||
key={channelId}
|
key={channelId}
|
||||||
>
|
>
|
||||||
<ExpansionPanelSummary
|
<AccordionSummary
|
||||||
expandIcon={<IconChevronDown />}
|
expandIcon={<IconChevronDown />}
|
||||||
classes={summaryClasses}
|
classes={summaryClasses}
|
||||||
>
|
>
|
||||||
|
@ -192,7 +192,7 @@ const ChannelsWithVariantsAvailabilityDialogContent: React.FC<ChannelsWithVarian
|
||||||
</div>
|
</div>
|
||||||
<Divider />
|
<Divider />
|
||||||
</div>
|
</div>
|
||||||
</ExpansionPanelSummary>
|
</AccordionSummary>
|
||||||
{allVariants.map(({ id: variantId, name }) => (
|
{allVariants.map(({ id: variantId, name }) => (
|
||||||
<React.Fragment key={variantId}>
|
<React.Fragment key={variantId}>
|
||||||
<div
|
<div
|
||||||
|
@ -215,7 +215,7 @@ const ChannelsWithVariantsAvailabilityDialogContent: React.FC<ChannelsWithVarian
|
||||||
<Divider />
|
<Divider />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</ExpansionPanel>
|
</Accordion>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {
|
import {
|
||||||
|
Accordion,
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
Divider,
|
Divider,
|
||||||
ExpansionPanel,
|
|
||||||
Typography
|
Typography
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import CardTitle from "@saleor/components/CardTitle";
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
|
@ -67,7 +67,7 @@ const ShippingZonesCard: React.FC<ShippingZonesCardProps> = props => {
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Typography>{intl.formatMessage(messages.subtitle)}</Typography>
|
<Typography>{intl.formatMessage(messages.subtitle)}</Typography>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<ExpansionPanel classes={expanderClasses}>
|
<Accordion classes={expanderClasses}>
|
||||||
<ShippingZonesListHeader shippingZones={shippingZones} />
|
<ShippingZonesListHeader shippingZones={shippingZones} />
|
||||||
<Divider />
|
<Divider />
|
||||||
{shippingZones.map(zone => (
|
{shippingZones.map(zone => (
|
||||||
|
@ -76,7 +76,7 @@ const ShippingZonesCard: React.FC<ShippingZonesCardProps> = props => {
|
||||||
{hasMoreZonesToBeSelected ? (
|
{hasMoreZonesToBeSelected ? (
|
||||||
<ShippingZonesCardListFooter {...props} />
|
<ShippingZonesCardListFooter {...props} />
|
||||||
) : null}
|
) : null}
|
||||||
</ExpansionPanel>
|
</Accordion>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ExpansionPanelSummary, Typography } from "@material-ui/core";
|
import { AccordionSummary, Typography } from "@material-ui/core";
|
||||||
import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer";
|
import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer";
|
||||||
import { ChannelShippingZones } from "@saleor/channels/pages/ChannelDetailsPage/types";
|
import { ChannelShippingZones } from "@saleor/channels/pages/ChannelDetailsPage/types";
|
||||||
import IconChevronDown from "@saleor/icons/ChevronDown";
|
import IconChevronDown from "@saleor/icons/ChevronDown";
|
||||||
|
@ -58,13 +58,13 @@ const ShippingZonesListHeader: React.FC<ShippingZonesListHeaderProps> = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.container}>
|
<div className={classes.container}>
|
||||||
<ExpansionPanelSummary expandIcon={<IconChevronDown />} classes={classes}>
|
<AccordionSummary expandIcon={<IconChevronDown />} classes={classes}>
|
||||||
<Typography variant="subtitle2" color="textSecondary">
|
<Typography variant="subtitle2" color="textSecondary">
|
||||||
{intl.formatMessage(messages.title, {
|
{intl.formatMessage(messages.title, {
|
||||||
zonesCount: shippingZones.length
|
zonesCount: shippingZones.length
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</ExpansionPanelSummary>
|
</AccordionSummary>
|
||||||
<HorizontalSpacer spacing={1.5} />
|
<HorizontalSpacer spacing={1.5} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
import {
|
import { Accordion, AccordionSummary, Typography } from "@material-ui/core";
|
||||||
ExpansionPanel,
|
|
||||||
ExpansionPanelSummary,
|
|
||||||
Typography
|
|
||||||
} from "@material-ui/core";
|
|
||||||
import { ChannelData } from "@saleor/channels/utils";
|
import { ChannelData } from "@saleor/channels/utils";
|
||||||
import IconChevronDown from "@saleor/icons/ChevronDown";
|
import IconChevronDown from "@saleor/icons/ChevronDown";
|
||||||
import { makeStyles } from "@saleor/macaw-ui";
|
import { makeStyles } from "@saleor/macaw-ui";
|
||||||
|
@ -76,19 +72,16 @@ const ChannelContentWrapper: React.FC<ChannelContentWrapperProps> = ({
|
||||||
const { name } = data;
|
const { name } = data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ExpansionPanel
|
<Accordion classes={expanderClasses} data-test="channel-availability-item">
|
||||||
classes={expanderClasses}
|
<AccordionSummary
|
||||||
data-test="channel-availability-item"
|
|
||||||
>
|
|
||||||
<ExpansionPanelSummary
|
|
||||||
expandIcon={<IconChevronDown />}
|
expandIcon={<IconChevronDown />}
|
||||||
classes={summaryClasses}
|
classes={summaryClasses}
|
||||||
>
|
>
|
||||||
<Typography>{name}</Typography>
|
<Typography>{name}</Typography>
|
||||||
<Typography variant="caption">{messages.availableDateText}</Typography>
|
<Typography variant="caption">{messages.availableDateText}</Typography>
|
||||||
</ExpansionPanelSummary>
|
</AccordionSummary>
|
||||||
{children}
|
{children}
|
||||||
</ExpansionPanel>
|
</Accordion>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
ExpansionPanel,
|
Accordion,
|
||||||
ExpansionPanelSummary,
|
AccordionSummary,
|
||||||
makeStyles,
|
makeStyles,
|
||||||
Paper,
|
Paper,
|
||||||
Typography
|
Typography
|
||||||
|
@ -208,14 +208,14 @@ const FilterContent: React.FC<FilterContentProps> = ({
|
||||||
const currentFilter = getFilterFromCurrentData(filter);
|
const currentFilter = getFilterFromCurrentData(filter);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ExpansionPanel
|
<Accordion
|
||||||
key={filter.name}
|
key={filter.name}
|
||||||
classes={expanderClasses}
|
classes={expanderClasses}
|
||||||
data-test="channel-availability-item"
|
data-test="channel-availability-item"
|
||||||
data-test-id={filter.name}
|
data-test-id={filter.name}
|
||||||
expanded={filter.name === openedFilter?.name}
|
expanded={filter.name === openedFilter?.name}
|
||||||
>
|
>
|
||||||
<ExpansionPanelSummary
|
<AccordionSummary
|
||||||
expandIcon={<IconChevronDown />}
|
expandIcon={<IconChevronDown />}
|
||||||
classes={summaryClasses}
|
classes={summaryClasses}
|
||||||
onClick={() => handleFilterOpen(filter)}
|
onClick={() => handleFilterOpen(filter)}
|
||||||
|
@ -226,7 +226,7 @@ const FilterContent: React.FC<FilterContentProps> = ({
|
||||||
handleFilterPropertyGroupChange(action, filter)
|
handleFilterPropertyGroupChange(action, filter)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ExpansionPanelSummary>
|
</AccordionSummary>
|
||||||
{currentFilter?.active && (
|
{currentFilter?.active && (
|
||||||
<FilterErrorsList
|
<FilterErrorsList
|
||||||
errors={errors?.[filter.name]}
|
errors={errors?.[filter.name]}
|
||||||
|
@ -259,7 +259,7 @@ const FilterContent: React.FC<FilterContentProps> = ({
|
||||||
filter={currentFilter}
|
filter={currentFilter}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</ExpansionPanel>
|
</Accordion>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
ExpansionPanel,
|
Accordion,
|
||||||
ExpansionPanelDetails,
|
AccordionDetails,
|
||||||
ExpansionPanelSummary,
|
AccordionSummary,
|
||||||
Typography
|
Typography
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
|
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
|
||||||
|
@ -93,8 +93,8 @@ export const TimelineEvent: React.FC<TimelineEventProps> = props => {
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<span className={classes.dot} />
|
<span className={classes.dot} />
|
||||||
{children ? (
|
{children ? (
|
||||||
<ExpansionPanel className={classes.panel} elevation={0}>
|
<Accordion className={classes.panel} elevation={0}>
|
||||||
<ExpansionPanelSummary
|
<AccordionSummary
|
||||||
className={classes.panelExpander}
|
className={classes.panelExpander}
|
||||||
expandIcon={<ExpandMoreIcon />}
|
expandIcon={<ExpandMoreIcon />}
|
||||||
>
|
>
|
||||||
|
@ -103,11 +103,11 @@ export const TimelineEvent: React.FC<TimelineEventProps> = props => {
|
||||||
date={date}
|
date={date}
|
||||||
titleElements={titleElements}
|
titleElements={titleElements}
|
||||||
/>
|
/>
|
||||||
</ExpansionPanelSummary>
|
</AccordionSummary>
|
||||||
<ExpansionPanelDetails>
|
<AccordionDetails>
|
||||||
<Typography>{children}</Typography>
|
<Typography>{children}</Typography>
|
||||||
</ExpansionPanelDetails>
|
</AccordionDetails>
|
||||||
</ExpansionPanel>
|
</Accordion>
|
||||||
) : (
|
) : (
|
||||||
<TimelineEventHeader
|
<TimelineEventHeader
|
||||||
title={title}
|
title={title}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {
|
import {
|
||||||
|
Accordion,
|
||||||
|
AccordionSummary,
|
||||||
CardContent,
|
CardContent,
|
||||||
Divider,
|
Divider,
|
||||||
ExpansionPanel,
|
|
||||||
ExpansionPanelSummary,
|
|
||||||
Typography
|
Typography
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import Skeleton from "@saleor/components/Skeleton";
|
import Skeleton from "@saleor/components/Skeleton";
|
||||||
|
@ -138,8 +138,8 @@ const VariantDetailsChannelsAvailabilityCard: React.FC<VariantDetailsChannelsAva
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CardContainer>
|
<CardContainer>
|
||||||
<ExpansionPanel classes={expanderClasses}>
|
<Accordion classes={expanderClasses}>
|
||||||
<ExpansionPanelSummary
|
<AccordionSummary
|
||||||
expandIcon={<IconChevronDown />}
|
expandIcon={<IconChevronDown />}
|
||||||
classes={summaryClasses}
|
classes={summaryClasses}
|
||||||
data-test-id="channels-variant-availability-summary"
|
data-test-id="channels-variant-availability-summary"
|
||||||
|
@ -150,7 +150,7 @@ const VariantDetailsChannelsAvailabilityCard: React.FC<VariantDetailsChannelsAva
|
||||||
availableChannelsCount: allAvailableChannelsListings.length
|
availableChannelsCount: allAvailableChannelsListings.length
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</ExpansionPanelSummary>
|
</AccordionSummary>
|
||||||
|
|
||||||
{channelListings.map(({ channel }) => (
|
{channelListings.map(({ channel }) => (
|
||||||
<React.Fragment key={channel.id}>
|
<React.Fragment key={channel.id}>
|
||||||
|
@ -170,7 +170,7 @@ const VariantDetailsChannelsAvailabilityCard: React.FC<VariantDetailsChannelsAva
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</ExpansionPanel>
|
</Accordion>
|
||||||
</CardContainer>
|
</CardContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue