Fix commented issues

This commit is contained in:
Krzysztof Bialoglowicz 2019-09-16 13:43:02 +02:00
parent 1f6386c368
commit c59ed7664b
6 changed files with 34 additions and 37 deletions

View file

@ -148,20 +148,18 @@ const CollectionDetailsPage: React.StatelessComponent<
}
)}
>
<>
<FormSpacer />
<Hr />
<ControlledCheckbox
name={"isFeatured" as keyof CollectionDetailsPageFormData}
label={intl.formatMessage({
defaultMessage: "Feature on Homepage",
description: "switch button"
})}
checked={data.isFeatured}
onChange={change}
disabled={disabled}
/>
</>
<FormSpacer />
<Hr />
<ControlledCheckbox
name={"isFeatured" as keyof CollectionDetailsPageFormData}
label={intl.formatMessage({
defaultMessage: "Feature on Homepage",
description: "switch button"
})}
checked={data.isFeatured}
onChange={change}
disabled={disabled}
/>
</VisibilityCard>
</div>
</div>

View file

@ -23,18 +23,16 @@ const styles = createStyles({
"& > span": {
padding: "6px"
}
},
secondLabel: {
display: "block",
fontSize: "12px"
}
});
interface RadioGroupFieldChoice {
value: string;
label: React.ReactNode;
}
interface RadioGroupFieldProps {
choices: Array<{
value: string;
label: React.ReactNode;
}>;
choices: RadioGroupFieldChoice[];
className?: string;
disabled?: boolean;
error?: boolean;

View file

@ -51,13 +51,13 @@ export const RadioSwitchField = withStyles(styles, {
secondOptionLabel,
value
}: RadioSwitchFieldProps & WithStyles<typeof styles>) => {
const initialValue = value ? "visible" : "hidden";
const initialValue = value ? "true" : "false";
const change = event => {
onChange({
target: {
name: event.target.name,
value: event.target.value === "visible" ? true : false
value: event.target.value === "true" ? true : false
}
} as any);
};
@ -75,14 +75,14 @@ export const RadioSwitchField = withStyles(styles, {
onChange={event => change(event)}
>
<FormControlLabel
value="visible"
value="true"
className={classes.radioLabel}
control={<Radio color="primary" />}
label={firstOptionLabel}
name={name}
/>
<FormControlLabel
value="hidden"
value="false"
className={classes.radioLabel}
control={<Radio color="primary" />}
label={secondOptionLabel}

View file

@ -19,14 +19,16 @@ import PageHeader from "../components/PageHeader";
import { PermissionEnum } from "../types/globalTypes";
export interface MenuItem {
description: string;
icon: React.ReactElement<IconProps>;
permission: PermissionEnum;
title: string;
url?: string;
}
export interface MenuSection {
label: string;
menuItems: Array<{
description: string;
icon: React.ReactElement<IconProps>;
permission: PermissionEnum;
title: string;
url?: string;
}>;
menuItems: MenuItem[];
}
const styles = (theme: Theme) =>
@ -87,7 +89,7 @@ const styles = (theme: Theme) =>
});
export interface ConfigurationPageProps {
menu: MenuItem[];
menu: MenuSection[];
user: User;
onSectionClick: (sectionName: string) => void;
}

View file

@ -25,9 +25,9 @@ import { siteSettingsUrl } from "@saleor/siteSettings/urls";
import { staffListUrl } from "@saleor/staff/urls";
import { taxSection } from "@saleor/taxes/urls";
import { PermissionEnum } from "@saleor/types/globalTypes";
import ConfigurationPage, { MenuItem } from "./ConfigurationPage";
import ConfigurationPage, { MenuSection } from "./ConfigurationPage";
export function createConfigurationMenu(intl: IntlShape): MenuItem[] {
export function createConfigurationMenu(intl: IntlShape): MenuSection[] {
return [
{
label: intl.formatMessage({

View file

@ -1,5 +1,4 @@
import Button from "@material-ui/core/Button";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";