Skip to content

Commit

Permalink
'Correct' ListItem (makes it worse)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrookes committed Oct 10, 2019
1 parent 8db91c6 commit 461baf8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 51 deletions.
4 changes: 2 additions & 2 deletions framer/Material-UI.framerfx/code/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export const IconButton: React.SFC<Props> = (props: Props) => {
const { badgeColor, badgeContent, height, icon, iconTheme, width, ...other } = props;
const IconBadge =
badgeContent === '' ? (
<Icon icon={icon} />
<Icon icon={icon} theme={iconTheme} />
) : (
<MuiBadge badgeContent={badgeContent} color={badgeColor}>
<Icon icon={icon} />
<Icon icon={icon} theme={iconTheme} />
</MuiBadge>
);

Expand Down
22 changes: 6 additions & 16 deletions framer/Material-UI.framerfx/code/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const ListItem: React.SFC<Props> = (props: Props) => {
case 'checkbox':
primary = (
<MuiListItemIcon>
<MuiCheckbox />
<MuiCheckbox edge="start" />
</MuiListItemIcon>
);
break;
Expand All @@ -120,21 +120,13 @@ export const ListItem: React.SFC<Props> = (props: Props) => {
);
break;
case 'iconButton':
secondary = (
<MuiListItemIcon>
<IconButton icon={secondaryIcon} />
</MuiListItemIcon>
);
secondary = <IconButton icon={secondaryIcon} edge="end" />;
break;
case 'checkbox':
secondary = (
<MuiListItemIcon>
<MuiCheckbox />
</MuiListItemIcon>
);
secondary = <MuiCheckbox edge="end" />;
break;
case 'switch':
secondary = <MuiSwitch />;
secondary = <MuiSwitch edge="end" />;
break;
}

Expand All @@ -146,10 +138,8 @@ export const ListItem: React.SFC<Props> = (props: Props) => {
primary={label}
secondary={secondaryLabel ? secondaryLabel : undefined}
/>
{/* This causes the text to have a bullet. No idea why! */}
{/* <MuiListItemSecondaryAction> */}
{secondary}
{/* </MuiListItemSecondaryAction> */}
{/* MuiListItemSecondaryAction causes the text to have a bullet. No idea why! */}
<MuiListItemSecondaryAction>{secondary}</MuiListItemSecondaryAction>
</MuiListItem>
);
};
Expand Down
1 change: 0 additions & 1 deletion framer/Material-UI.framerfx/design/document.json
Original file line number Diff line number Diff line change
Expand Up @@ -3269,7 +3269,6 @@
"badgeColor" : "primary",
"badgeContent" : "9",
"icon" : "",
"invisible" : false,
"max" : 99,
"showZero" : false,
"theme" : "Filled",
Expand Down
4 changes: 2 additions & 2 deletions framer/scripts/templates/icon_button.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export const «componentName»: React.SFC<Props> = (props: Props) => {
const { badgeColor, badgeContent, height, icon, iconTheme, width, ...other } = props;
const IconBadge =
badgeContent === '' ? (
<Icon icon={icon} />
<Icon icon={icon} theme={iconTheme} />
) : (
<MuiBadge badgeContent={badgeContent} color={badgeColor}>
<Icon icon={icon} />
<Icon icon={icon} theme={iconTheme} />
</MuiBadge>
);

Expand Down
68 changes: 38 additions & 30 deletions framer/scripts/templates/list_item.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,54 +35,64 @@ const defaultProps: Props = {
};

export const «componentName»: React.SFC<Props> = (props: Props) => {
const {
height,
imageFile,
imageUrl,
inset,
label,
primaryAction,
primaryIcon,
secondaryAction,
const {
height,
imageFile,
imageUrl,
inset,
label,
primaryAction,
primaryIcon,
secondaryAction,
secondaryIcon,
secondaryLabel,
width,
...other
secondaryLabel,
width,
...other
} = props;

let primary = null;
let secondary = null;

switch (primaryAction) {
case 'icon':
primary = (<MuiListItemIcon>
<Icon icon={primaryIcon} />
</MuiListItemIcon>);
primary = (
<MuiListItemIcon>
<Icon icon={primaryIcon} />
</MuiListItemIcon>
);
break;
case 'avatar':
primary = (<MuiListItemAvatar><Avatar icon={primaryIcon} imageFile={imageFile} imageUrl={imageUrl}/></MuiListItemAvatar>);
primary = (
<MuiListItemAvatar>
<Avatar icon={primaryIcon} imageFile={imageFile} imageUrl={imageUrl} />
</MuiListItemAvatar>
);
break;
case 'checkbox':
primary = (<MuiListItemIcon><MuiCheckbox /></MuiListItemIcon>);
primary = (
<MuiListItemIcon>
<MuiCheckbox edge="start" />
</MuiListItemIcon>
);
break;
}

switch (secondaryAction) {
case 'icon':
secondary = (<MuiListItemIcon>
<Icon icon={secondaryIcon} />
</MuiListItemIcon>);
secondary = (
<MuiListItemIcon>
<Icon icon={secondaryIcon} />
</MuiListItemIcon>
);
break;
case 'iconButton':
secondary = (<MuiListItemIcon>
<IconButton icon={secondaryIcon} />
</MuiListItemIcon>);
secondary = <IconButton icon={secondaryIcon} edge="end" />;
break;
case 'checkbox':
secondary = (<MuiListItemIcon><MuiCheckbox /></MuiListItemIcon>);
secondary = <MuiCheckbox edge="end" />;
break;
case 'switch':
secondary = (<MuiSwitch />);
secondary = <MuiSwitch edge="end" />;
break;
}

Expand All @@ -94,13 +104,11 @@ export const «componentName»: React.SFC<Props> = (props: Props) => {
primary={label}
secondary={secondaryLabel ? secondaryLabel : undefined}
/>
{/* This causes the text to have a bullet. No idea why! */}
{/* <MuiListItemSecondaryAction> */}
{secondary}
{/* </MuiListItemSecondaryAction> */}
{/* MuiListItemSecondaryAction causes the text to have a bullet. No idea why! */}
<MuiListItemSecondaryAction>{secondary}</MuiListItemSecondaryAction>
</MuiListItem>
);
}
};

«componentName».defaultProps = defaultProps;

Expand Down

0 comments on commit 461baf8

Please sign in to comment.