Fix small issues
This commit is contained in:
parent
9879990fcc
commit
4cc48250b2
12 changed files with 161 additions and 196 deletions
|
@ -104,7 +104,7 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({
|
|||
/>
|
||||
<FormSpacer />
|
||||
<ControlledCheckbox
|
||||
name={"valueRequired" as keyof FormData}
|
||||
name={"valueRequired" as keyof AttributePageFormData}
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Value Required",
|
||||
description: "check to require attribute to have value"
|
||||
|
|
|
@ -76,7 +76,7 @@ const AttributeValues: React.FC<AttributeValuesProps> = ({
|
|||
<Button color="primary" variant="text" onClick={onValueAdd}>
|
||||
<FormattedMessage
|
||||
defaultMessage="Assign value"
|
||||
description="add attribute value button"
|
||||
description="assign attribute value button"
|
||||
/>
|
||||
</Button>
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Card from "@material-ui/core/Card";
|
||||
import CardContent from "@material-ui/core/CardContent";
|
||||
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import { RawDraftContentState } from "draft-js";
|
||||
import React from "react";
|
||||
|
@ -13,13 +12,7 @@ import { commonMessages } from "@saleor/intl";
|
|||
import { maybe } from "../../../misc";
|
||||
import { CategoryDetails_category } from "../../types/CategoryDetails";
|
||||
|
||||
const styles = createStyles({
|
||||
root: {
|
||||
width: "100%"
|
||||
}
|
||||
});
|
||||
|
||||
interface CategoryDetailsFormProps extends WithStyles<typeof styles> {
|
||||
interface CategoryDetailsFormProps {
|
||||
category?: CategoryDetails_category;
|
||||
data: {
|
||||
name: string;
|
||||
|
@ -30,57 +23,52 @@ interface CategoryDetailsFormProps extends WithStyles<typeof styles> {
|
|||
onChange: (event: React.ChangeEvent<any>) => void;
|
||||
}
|
||||
|
||||
export const CategoryDetailsForm = withStyles(styles, {
|
||||
name: "CategoryDetailsForm"
|
||||
})(
|
||||
({
|
||||
category,
|
||||
classes,
|
||||
disabled,
|
||||
data,
|
||||
onChange,
|
||||
errors
|
||||
}: CategoryDetailsFormProps) => {
|
||||
const intl = useIntl();
|
||||
export const CategoryDetailsForm = ({
|
||||
category,
|
||||
classes,
|
||||
disabled,
|
||||
data,
|
||||
onChange,
|
||||
errors
|
||||
}: CategoryDetailsFormProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||
/>
|
||||
<CardContent>
|
||||
<>
|
||||
<div>
|
||||
<TextField
|
||||
classes={{ root: classes.root }}
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Category Name"
|
||||
})}
|
||||
name="name"
|
||||
disabled={disabled}
|
||||
value={data && data.name}
|
||||
onChange={onChange}
|
||||
error={!!errors.name}
|
||||
helperText={errors.name}
|
||||
/>
|
||||
</div>
|
||||
<FormSpacer />
|
||||
<RichTextEditor
|
||||
disabled={disabled}
|
||||
error={!!errors.descriptionJson}
|
||||
helperText={errors.descriptionJson}
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||
/>
|
||||
<CardContent>
|
||||
<>
|
||||
<div>
|
||||
<TextField
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Category Description"
|
||||
defaultMessage: "Category Name"
|
||||
})}
|
||||
initial={maybe(() => JSON.parse(category.descriptionJson))}
|
||||
name="description"
|
||||
name="name"
|
||||
disabled={disabled}
|
||||
value={data && data.name}
|
||||
onChange={onChange}
|
||||
error={!!errors.name}
|
||||
helperText={errors.name}
|
||||
fullWidth
|
||||
/>
|
||||
</>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
);
|
||||
CategoryDetailsForm.displayName = "CategoryDetailsForm";
|
||||
</div>
|
||||
<FormSpacer />
|
||||
<RichTextEditor
|
||||
disabled={disabled}
|
||||
error={!!errors.descriptionJson}
|
||||
helperText={errors.descriptionJson}
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Category Description"
|
||||
})}
|
||||
initial={maybe(() => JSON.parse(category.descriptionJson))}
|
||||
name="description"
|
||||
onChange={onChange}
|
||||
/>
|
||||
</>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
export default CategoryDetailsForm;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Card from "@material-ui/core/Card";
|
||||
import CardContent from "@material-ui/core/CardContent";
|
||||
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import { RawDraftContentState } from "draft-js";
|
||||
import React from "react";
|
||||
|
@ -14,13 +13,7 @@ import { maybe } from "@saleor/misc";
|
|||
import { FormErrors } from "@saleor/types";
|
||||
import { CollectionDetails_collection } from "../../types/CollectionDetails";
|
||||
|
||||
const styles = createStyles({
|
||||
name: {
|
||||
width: "100%"
|
||||
}
|
||||
});
|
||||
|
||||
export interface CollectionDetailsProps extends WithStyles<typeof styles> {
|
||||
export interface CollectionDetailsProps {
|
||||
collection?: CollectionDetails_collection;
|
||||
data: {
|
||||
description: RawDraftContentState;
|
||||
|
@ -31,50 +24,47 @@ export interface CollectionDetailsProps extends WithStyles<typeof styles> {
|
|||
onChange: (event: React.ChangeEvent<any>) => void;
|
||||
}
|
||||
|
||||
const CollectionDetails = withStyles(styles, { name: "CollectionDetails" })(
|
||||
({
|
||||
classes,
|
||||
collection,
|
||||
disabled,
|
||||
data,
|
||||
onChange,
|
||||
errors
|
||||
}: CollectionDetailsProps) => {
|
||||
const intl = useIntl();
|
||||
const CollectionDetails = ({
|
||||
classes,
|
||||
collection,
|
||||
disabled,
|
||||
data,
|
||||
onChange,
|
||||
errors
|
||||
}: CollectionDetailsProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||
/>
|
||||
<CardContent>
|
||||
<TextField
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Name",
|
||||
description: "collection name"
|
||||
})}
|
||||
name="name"
|
||||
disabled={disabled}
|
||||
value={data.name}
|
||||
onChange={onChange}
|
||||
error={!!errors.name}
|
||||
helperText={errors.name}
|
||||
fullWidth
|
||||
/>
|
||||
<CardContent>
|
||||
<TextField
|
||||
classes={{ root: classes.name }}
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Name",
|
||||
description: "collection name"
|
||||
})}
|
||||
name="name"
|
||||
disabled={disabled}
|
||||
value={data.name}
|
||||
onChange={onChange}
|
||||
error={!!errors.name}
|
||||
helperText={errors.name}
|
||||
/>
|
||||
<FormSpacer />
|
||||
<RichTextEditor
|
||||
error={!!errors.descriptionJson}
|
||||
helperText={errors.descriptionJson}
|
||||
initial={maybe(() => JSON.parse(collection.descriptionJson))}
|
||||
label={intl.formatMessage(commonMessages.description)}
|
||||
name="description"
|
||||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
);
|
||||
CollectionDetails.displayName = "CollectionDetails";
|
||||
<FormSpacer />
|
||||
<RichTextEditor
|
||||
error={!!errors.descriptionJson}
|
||||
helperText={errors.descriptionJson}
|
||||
initial={maybe(() => JSON.parse(collection.descriptionJson))}
|
||||
label={intl.formatMessage(commonMessages.description)}
|
||||
name="description"
|
||||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
export default CollectionDetails;
|
||||
|
|
|
@ -127,7 +127,7 @@ const CollectionDetailsPage: React.StatelessComponent<
|
|||
onChange={change}
|
||||
>
|
||||
<ControlledCheckbox
|
||||
name={"isFeatured" as keyof FormData}
|
||||
name={"isFeatured" as keyof CollectionDetailsPageFormData}
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Feature on Homepage",
|
||||
description: "switch button"
|
||||
|
|
|
@ -21,12 +21,12 @@ const styles = createStyles({
|
|||
},
|
||||
radioLabel: {
|
||||
"& > span": {
|
||||
"& > span": {
|
||||
display: "block",
|
||||
fontSize: "12px"
|
||||
},
|
||||
padding: "6px"
|
||||
}
|
||||
},
|
||||
secondLabel: {
|
||||
display: "block",
|
||||
fontSize: "12px"
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -77,22 +77,22 @@ export const RadioGroupField = withStyles(styles, {
|
|||
onChange={onChange}
|
||||
>
|
||||
{choices.length > 0 ? (
|
||||
choices.map(choice => {
|
||||
return (
|
||||
<FormControlLabel
|
||||
value={choice.value}
|
||||
className={classes.radioLabel}
|
||||
control={<Radio color="primary" />}
|
||||
label={
|
||||
<>
|
||||
{choice.label}
|
||||
<span>{choice.secondLabel}</span>
|
||||
</>
|
||||
}
|
||||
key={choice.value}
|
||||
/>
|
||||
);
|
||||
})
|
||||
choices.map(choice => (
|
||||
<FormControlLabel
|
||||
value={choice.value}
|
||||
className={classes.radioLabel}
|
||||
control={<Radio color="primary" />}
|
||||
label={
|
||||
<>
|
||||
{choice.label}
|
||||
<span className={classes.secondLabel}>
|
||||
{choice.secondLabel}
|
||||
</span>
|
||||
</>
|
||||
}
|
||||
key={choice.value}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<MenuItem disabled={true}>
|
||||
<FormattedMessage defaultMessage="No results found" />
|
||||
|
|
|
@ -37,12 +37,6 @@ const styles = (theme: Theme) =>
|
|||
fontSize: "14px",
|
||||
paddingTop: "15px",
|
||||
textDecoration: "underline"
|
||||
},
|
||||
switchContainer: {
|
||||
"& > div": {
|
||||
padding: 0
|
||||
},
|
||||
marginBottom: -theme.spacing.unit
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -154,8 +148,10 @@ export const VisibilityCard = withStyles(styles, {
|
|||
className={classes.setPublicationDate}
|
||||
onClick={() => setPublicationDate(!isPublicationDate)}
|
||||
>
|
||||
{" "}
|
||||
Set publication date
|
||||
{intl.formatMessage({
|
||||
defaultMessage: "Set publication date",
|
||||
description: "set publication date"
|
||||
})}
|
||||
</Typography>
|
||||
)}
|
||||
{isPublicationDate && (
|
||||
|
|
|
@ -4,8 +4,8 @@ import React from "react";
|
|||
export const Attributes = createSvgIcon(
|
||||
<>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M37.9487 10.4808C37.9487 14.4459 34.7343 17.6603 30.7692 17.6603C26.8041 17.6603 23.5897 14.4459 23.5897 10.4808C23.5897 6.51565 26.8041 3.30128 30.7692 3.30128C34.7343 3.30128 37.9487 6.51565 37.9487 10.4808ZM40 10.4808C40 15.5788 35.8672 19.7115 30.7692 19.7115C25.6712 19.7115 21.5385 15.5788 21.5385 10.4808C21.5385 5.38275 25.6712 1.25 30.7692 1.25C35.8672 1.25 40 5.38275 40 10.4808ZM16.4103 9.45484H2.05128V23.8138H16.4103V9.45484ZM0 7.40356V25.8651H18.4615V7.40356H0ZM24.6154 20.7371L13.9566 39.1987H35.2741L24.6154 20.7371ZM24.6154 24.8397L17.5095 37.1474H31.7212L24.6154 24.8397Z"
|
||||
fill="#06847B"
|
||||
/>
|
||||
|
|
|
@ -54,7 +54,7 @@ export const PageCreate: React.StatelessComponent<PageCreateProps> = () => {
|
|||
page={null}
|
||||
onBack={() => navigate(pageListUrl())}
|
||||
onRemove={() => undefined}
|
||||
onSubmit={formData => {
|
||||
onSubmit={formData =>
|
||||
pageCreate({
|
||||
variables: {
|
||||
input: {
|
||||
|
@ -77,8 +77,8 @@ export const PageCreate: React.StatelessComponent<PageCreateProps> = () => {
|
|||
title: formData.title
|
||||
}
|
||||
}
|
||||
});
|
||||
}}
|
||||
})
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -36,7 +36,7 @@ const ProductTypeListPage: React.StatelessComponent<
|
|||
<FormattedMessage
|
||||
defaultMessage="create product type"
|
||||
description="button"
|
||||
/>{" "}
|
||||
/>
|
||||
</Button>
|
||||
</PageHeader>
|
||||
<ProductTypeList disabled={disabled} {...listProps} />
|
||||
|
|
|
@ -25,7 +25,7 @@ const styles = (theme: Theme) =>
|
|||
}
|
||||
});
|
||||
|
||||
interface ProductDetailsFormProps extends WithStyles<typeof styles> {
|
||||
interface ProductDetailsFormProps {
|
||||
data: {
|
||||
description: RawDraftContentState;
|
||||
name: string;
|
||||
|
@ -39,54 +39,47 @@ interface ProductDetailsFormProps extends WithStyles<typeof styles> {
|
|||
onChange(event: any);
|
||||
}
|
||||
|
||||
export const ProductDetailsForm = withStyles(styles, {
|
||||
name: "ProductDetailsForm"
|
||||
})(
|
||||
({
|
||||
classes,
|
||||
data,
|
||||
disabled,
|
||||
errors,
|
||||
initialDescription,
|
||||
onChange
|
||||
}: ProductDetailsFormProps) => {
|
||||
const intl = useIntl();
|
||||
export const ProductDetailsForm = ({
|
||||
classes,
|
||||
data,
|
||||
disabled,
|
||||
errors,
|
||||
initialDescription,
|
||||
onChange
|
||||
}: ProductDetailsFormProps) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||
return (
|
||||
<Card>
|
||||
<CardTitle
|
||||
title={intl.formatMessage(commonMessages.generalInformations)}
|
||||
/>
|
||||
<CardContent>
|
||||
<TextField
|
||||
error={!!errors.name}
|
||||
helperText={errors.name}
|
||||
disabled={disabled}
|
||||
fullWidth
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Name",
|
||||
description: "product name"
|
||||
})}
|
||||
name="name"
|
||||
value={data.name}
|
||||
onChange={onChange}
|
||||
/>
|
||||
<CardContent>
|
||||
<div className={classes.root}>
|
||||
<TextField
|
||||
error={!!errors.name}
|
||||
helperText={errors.name}
|
||||
disabled={disabled}
|
||||
fullWidth
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Name",
|
||||
description: "product name"
|
||||
})}
|
||||
name="name"
|
||||
value={data.name}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</div>
|
||||
<FormSpacer />
|
||||
<RichTextEditor
|
||||
disabled={disabled}
|
||||
error={!!errors.descriptionJson}
|
||||
helperText={errors.descriptionJson}
|
||||
initial={initialDescription}
|
||||
label={intl.formatMessage(commonMessages.description)}
|
||||
name="description"
|
||||
onChange={onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
);
|
||||
ProductDetailsForm.displayName = "ProductDetailsForm";
|
||||
<FormSpacer />
|
||||
<RichTextEditor
|
||||
disabled={disabled}
|
||||
error={!!errors.descriptionJson}
|
||||
helperText={errors.descriptionJson}
|
||||
initial={initialDescription}
|
||||
label={intl.formatMessage(commonMessages.description)}
|
||||
name="description"
|
||||
onChange={onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
export default ProductDetailsForm;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// import Button from "@material-ui/core/Button";
|
||||
//
|
||||
import React from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
|
|
Loading…
Reference in a new issue