Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[framer] Fix Avatar imageFile & imageUrl #21887

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 40 additions & 43 deletions framer/Material-UI.framerfx/code/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ interface Props {
backgroundColor?: string;
textColor?: string;
icon?: string;
imageFile?: string;
imageUrl?: string;
avatarImageFile?: string;
avatarImageUrl?: string;
label?: string;
width?: number;
height?: number;
}

const defaultProps: Props = {
const defaultProps: Props = {
variant: 'circle',
backgroundColor: '#4154af',
textColor: undefined,
icon: 'face',
imageFile: '',
imageUrl: 'https://i.pravatar.cc/300',
avatarImageFile: '',
avatarImageUrl: 'https://i.pravatar.cc/300',
label: 'MB',
width: 40,
height: 40,
Expand All @@ -34,8 +34,8 @@ export const Avatar: React.SFC<Props> = (props: Props) => {
backgroundColor,
height,
icon,
imageFile,
imageUrl,
avatarImageFile: imageFile,
avatarImageUrl: imageUrl,
label,
textColor,
width,
Expand All @@ -49,44 +49,41 @@ export const Avatar: React.SFC<Props> = (props: Props) => {
{icon === '' ? label : <Icon icon={icon} />}
</MuiAvatar>
);
};
}

Avatar.defaultProps = defaultProps;

addPropertyControls(Avatar, {
variant: {
type: ControlType.Enum,
title: 'Variant',
options: ['circle', 'rounded', 'square'],
},
backgroundColor: {
type: ControlType.Color,
title: 'Background color',
},
textColor: {
type: ControlType.Color,
title: 'Text color',
},
icon: {
type: ControlType.String,
title: 'Icon',
},
imageFile: {
type: ControlType.Image,
title: 'Image File',
hidden: function hidden(props) {
return props.primaryAction && props.primaryAction !== 'avatar';
},
},
imageUrl: {
type: ControlType.String,
title: 'Image URL',
hidden: function hidden(props) {
return props.imageFile !== '' || (props.primaryAction && props.primaryAction !== 'avatar');
},
},
label: {
type: ControlType.String,
title: 'Label',
},
variant: {
type: ControlType.Enum,
title: 'Variant',
options: ['circle', 'rounded', 'square'],
},
backgroundColor: {
type: ControlType.Color,
title: 'Background color',
},
textColor: {
type: ControlType.Color,
title: 'Text color',
},
icon: {
type: ControlType.String,
title: 'Icon',
},
avatarImageFile: {
type: ControlType.Image,
title: 'Avatar Image File',
},
avatarImageUrl: {
type: ControlType.String,
title: 'Avatar Image URL',
hidden: function hidden(props) {
return props.avatarImageFile !== '';
},
},
label: {
type: ControlType.String,
title: 'Label',
},
});
4 changes: 2 additions & 2 deletions framer/scripts/framerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const componentSettings = {
backgroundColor: "'#4154af'",
textColor: "'#ffffff'",
icon: "'face'",
imageFile: "''",
imageUrl: "'https://i.pravatar.cc/300'",
avatarImageFile: "''",
avatarImageUrl: "'https://i.pravatar.cc/300'",
label: "'MB'",
width: 40,
height: 40,
Expand Down
4 changes: 2 additions & 2 deletions framer/scripts/templates/avatar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const «componentName»: React.SFC<Props> = (props: Props) => {
backgroundColor,
height,
icon,
imageFile,
imageUrl,
avatarImageFile: imageFile,
avatarImageUrl: imageUrl,
label,
textColor,
width,
Expand Down