From 5fd29d5cf3f9ed701fa72906d07b1c570fe672b1 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 23 Jul 2020 01:48:02 +0100 Subject: [PATCH] [framer] Fix Avatar imageFile & imageUrl --- framer/Material-UI.framerfx/code/Avatar.tsx | 83 ++++++++++----------- framer/scripts/framerConfig.js | 4 +- framer/scripts/templates/avatar.txt | 4 +- 3 files changed, 44 insertions(+), 47 deletions(-) diff --git a/framer/Material-UI.framerfx/code/Avatar.tsx b/framer/Material-UI.framerfx/code/Avatar.tsx index a5f5d3a47d9ef5..b8fecebac13456 100644 --- a/framer/Material-UI.framerfx/code/Avatar.tsx +++ b/framer/Material-UI.framerfx/code/Avatar.tsx @@ -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, @@ -34,8 +34,8 @@ export const Avatar: React.SFC = (props: Props) => { backgroundColor, height, icon, - imageFile, - imageUrl, + avatarImageFile: imageFile, + avatarImageUrl: imageUrl, label, textColor, width, @@ -49,44 +49,41 @@ export const Avatar: React.SFC = (props: Props) => { {icon === '' ? label : } ); -}; +} 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', +}, }); diff --git a/framer/scripts/framerConfig.js b/framer/scripts/framerConfig.js index f3b7f8c2faa682..6afd8acfb273cd 100644 --- a/framer/scripts/framerConfig.js +++ b/framer/scripts/framerConfig.js @@ -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, diff --git a/framer/scripts/templates/avatar.txt b/framer/scripts/templates/avatar.txt index 8b597362e5c30b..7593e59c295d38 100644 --- a/framer/scripts/templates/avatar.txt +++ b/framer/scripts/templates/avatar.txt @@ -19,8 +19,8 @@ export const «componentName»: React.SFC = (props: Props) => { backgroundColor, height, icon, - imageFile, - imageUrl, + avatarImageFile: imageFile, + avatarImageUrl: imageUrl, label, textColor, width,