Skip to content

Commit 3dfb429

Browse files
authored
[test] Type-check framerfx package (#21868)
1 parent 5126864 commit 3dfb429

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+804
-938
lines changed

framer/Material-UI.framerfx/code/AppBar.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
import * as React from 'react';
22
import { PropertyControls, ControlType } from 'framer';
3-
// tslint:disable-next-line: ban-ts-ignore
4-
// @ts-ignore
53
import MuiAppBar from '@material-ui/core/AppBar';
6-
// tslint:disable-next-line: ban-ts-ignore
7-
// @ts-ignore
84
import Toolbar from '@material-ui/core/Toolbar';
9-
// tslint:disable-next-line: ban-ts-ignore
10-
// @ts-ignore
115
import Typography from '@material-ui/core/Typography';
12-
// tslint:disable-next-line: ban-ts-ignore
13-
// @ts-ignore
146
import Button from '@material-ui/core/Button';
157
import { IconButton } from './IconButton';
168

@@ -74,8 +66,6 @@ export class AppBar extends React.Component<Props> {
7466
{leftIcon && (
7567
<IconButton
7668
icon={leftIcon}
77-
// tslint:disable-next-line: ban-ts-ignore
78-
// @ts-ignore
7969
style={{ marginLeft: -12, marginRight: 20 }}
8070
color="inherit"
8171
/>
@@ -90,8 +80,6 @@ export class AppBar extends React.Component<Props> {
9080
icon={icon1}
9181
badgeColor="secondary"
9282
badgeContent={icon1Badge}
93-
// tslint:disable-next-line: ban-ts-ignore
94-
// @ts-ignore
9583
style={{ marginRight: 8 }}
9684
color="inherit"
9785
/>
@@ -100,8 +88,6 @@ export class AppBar extends React.Component<Props> {
10088
<IconButton
10189
icon={icon2}
10290
badgeContent={icon2Badge}
103-
// tslint:disable-next-line: ban-ts-ignore
104-
// @ts-ignore
10591
style={{ marginRight: 8 }}
10692
color="inherit"
10793
/>

framer/Material-UI.framerfx/code/Avatar.tsx

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,27 @@
11
import * as React from 'react';
22
import { addPropertyControls, ControlType } from 'framer';
3-
// tslint:disable-next-line: ban-ts-ignore
4-
// @ts-ignore
53
import MuiAvatar from '@material-ui/core/Avatar';
64
import { Icon } from './Icon';
75

86
interface Props {
9-
variant?: 'circle' | 'rounded' | 'square';
10-
backgroundColor?: string;
11-
textColor?: string;
12-
icon?: string;
13-
imageFile?: string;
14-
imageUrl?: string;
15-
label?: string;
16-
width?: number;
17-
height?: number;
7+
variant: 'circle' | 'rounded' | 'square';
8+
backgroundColor: string;
9+
textColor: string;
10+
icon: string;
11+
avatarImageFile: string;
12+
avatarImageUrl: string;
13+
label: string;
14+
width: number | string;
15+
height: number;
1816
}
1917

20-
const defaultProps: Props = {
21-
variant: 'circle',
22-
backgroundColor: '#4154af',
23-
textColor: undefined,
24-
icon: 'face',
25-
imageFile: '',
26-
imageUrl: 'https://i.pravatar.cc/300',
27-
label: 'MB',
28-
width: 40,
29-
height: 40,
30-
};
31-
32-
export const Avatar: React.SFC<Props> = (props: Props) => {
18+
export function Avatar(props: Props): JSX.Element {
3319
const {
3420
backgroundColor,
3521
height,
3622
icon,
37-
imageFile,
38-
imageUrl,
23+
avatarImageFile: imageFile,
24+
avatarImageUrl: imageUrl,
3925
label,
4026
textColor,
4127
width,
@@ -49,9 +35,19 @@ export const Avatar: React.SFC<Props> = (props: Props) => {
4935
{icon === '' ? label : <Icon icon={icon} />}
5036
</MuiAvatar>
5137
);
52-
};
38+
}
5339

54-
Avatar.defaultProps = defaultProps;
40+
Avatar.defaultProps = {
41+
variant: 'circle' as 'circle',
42+
backgroundColor: '#4154af',
43+
textColor: undefined,
44+
icon: 'face',
45+
avatarImageFile: '',
46+
avatarImageUrl: 'https://i.pravatar.cc/300',
47+
label: 'MB',
48+
width: 40,
49+
height: 40,
50+
};
5551

5652
addPropertyControls(Avatar, {
5753
variant: {
@@ -71,18 +67,15 @@ addPropertyControls(Avatar, {
7167
type: ControlType.String,
7268
title: 'Icon',
7369
},
74-
imageFile: {
70+
avatarImageFile: {
7571
type: ControlType.Image,
76-
title: 'Image File',
77-
hidden: function hidden(props) {
78-
return props.primaryAction && props.primaryAction !== 'avatar';
79-
},
72+
title: 'Avatar Image File',
8073
},
81-
imageUrl: {
74+
avatarImageUrl: {
8275
type: ControlType.String,
83-
title: 'Image URL',
76+
title: 'Avatar Image URL',
8477
hidden: function hidden(props) {
85-
return props.imageFile !== '' || (props.primaryAction && props.primaryAction !== 'avatar');
78+
return props.avatarImageFile !== '';
8679
},
8780
},
8881
label: {

framer/Material-UI.framerfx/code/Badge.tsx

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,49 @@
11
import * as React from 'react';
22
import { addPropertyControls, ControlType } from 'framer';
3-
// tslint:disable-next-line: ban-ts-ignore
4-
// @ts-ignore
53
import MuiBadge from '@material-ui/core/Badge';
64
import { Icon } from './Icon';
75

86
interface Props {
9-
badgeContent?: string;
10-
max?: number;
11-
showZero?: boolean;
12-
variant?: 'dot' | 'standard';
13-
icon?: string;
14-
theme?: 'Filled' | 'Outlined' | 'Rounded' | 'TwoTone' | 'Sharp';
15-
badgeColor?: 'default' | 'primary' | 'secondary' | 'error';
16-
width?: number;
17-
height?: number;
7+
badgeContent: string;
8+
max: number;
9+
showZero: boolean;
10+
variant: 'dot' | 'standard';
11+
icon: string;
12+
theme: 'Filled' | 'Outlined' | 'Rounded' | 'TwoTone' | 'Sharp';
13+
badgeColor: 'default' | 'primary' | 'secondary' | 'error';
14+
width: number | string;
15+
height: number;
1816
}
1917

20-
const defaultProps: Props = {
21-
badgeContent: '8',
22-
max: 99,
23-
showZero: false,
24-
variant: 'standard',
25-
icon: '',
26-
theme: 'Filled',
27-
badgeColor: 'primary',
28-
width: 22,
29-
height: 22,
30-
};
31-
3218
const style: React.CSSProperties = {
3319
display: 'flex',
3420
alignItems: 'center',
3521
justifyContent: 'center',
3622
};
3723

38-
export const Badge: React.SFC<Props> = (props: Props) => {
24+
export function Badge(props: Props): JSX.Element {
3925
const { badgeColor: color, badgeContent, icon, theme, width, height, ...other } = props;
4026
const content =
4127
icon === '' ? (
4228
badgeContent
4329
) : (
44-
// @ts-ignore
4530
<Icon icon={icon} theme={theme} style={{ width: '75%', height: '75%' }} />
4631
);
4732

4833
return <MuiBadge badgeContent={content} color={color} style={style} {...other} />;
49-
};
34+
}
5035

51-
Badge.defaultProps = defaultProps;
36+
Badge.defaultProps = {
37+
badgeContent: '8',
38+
max: 99,
39+
showZero: false,
40+
variant: 'standard' as 'standard',
41+
icon: '',
42+
theme: 'Filled' as 'Filled',
43+
badgeColor: 'primary' as 'primary',
44+
width: 22,
45+
height: 22,
46+
};
5247

5348
addPropertyControls(Badge, {
5449
badgeContent: {

framer/Material-UI.framerfx/code/BottomNavigation.tsx

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,23 @@
11
import * as React from 'react';
22
import { addPropertyControls, ControlType } from 'framer';
3-
// tslint:disable-next-line: ban-ts-ignore
4-
// @ts-ignore
53
import MuiBottomNavigation from '@material-ui/core/BottomNavigation';
6-
// tslint:disable-next-line: ban-ts-ignore
7-
// @ts-ignore
84
import MuiBottomNavigationAction from '@material-ui/core/BottomNavigationAction';
95
import { Icon } from './Icon';
106

117
interface Props {
12-
showLabels?: boolean;
13-
icons?: string[];
14-
labels?: string[];
15-
width?: number;
16-
height?: number;
8+
showLabels: boolean;
9+
icons: string[];
10+
labels: string[];
11+
width: number | string;
12+
height: number;
1713
}
1814

19-
const defaultProps: Props = {
20-
showLabels: false,
21-
icons: ['restore', 'favorite', 'location_on', 'folder'],
22-
labels: ['Recents', 'Favorites', 'Nearby', 'Saved'],
23-
width: 500,
24-
height: 56,
25-
};
26-
27-
export const BottomNavigation: React.SFC<Props> = (props: Props) => {
15+
export function BottomNavigation(props: Props): JSX.Element {
2816
const { labels, icons, ...other } = props;
2917

30-
// tslint:disable-next-line: ban-ts-ignore
31-
// @ts-ignore
3218
const [value, setValue] = React.useState(0);
3319

34-
const handleChange = (event, value) => {
20+
const handleChange = (event: React.SyntheticEvent, value: any) => {
3521
setValue(value);
3622
};
3723

@@ -52,9 +38,15 @@ export const BottomNavigation: React.SFC<Props> = (props: Props) => {
5238
)}
5339
</MuiBottomNavigation>
5440
);
55-
};
41+
}
5642

57-
BottomNavigation.defaultProps = defaultProps;
43+
BottomNavigation.defaultProps = {
44+
showLabels: false,
45+
icons: ['restore', 'favorite', 'location_on', 'folder'],
46+
labels: ['Recents', 'Favorites', 'Nearby', 'Saved'],
47+
width: 500,
48+
height: 56,
49+
};
5850

5951
addPropertyControls(BottomNavigation, {
6052
showLabels: {

framer/Material-UI.framerfx/code/Button.tsx

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,26 @@
11
import * as React from 'react';
22
import { addPropertyControls, ControlType } from 'framer';
3-
// tslint:disable-next-line: ban-ts-ignore
4-
// @ts-ignore
53
import MuiButton from '@material-ui/core/Button';
64
import { Icon } from './Icon';
75

86
interface Props {
9-
color?: 'inherit' | 'primary' | 'secondary';
10-
disabled?: boolean;
11-
disableElevation?: boolean;
12-
endIcon?: string;
13-
fullWidth?: boolean;
7+
color: 'inherit' | 'primary' | 'secondary';
8+
disabled: boolean;
9+
disableElevation: boolean;
10+
endIcon: string;
11+
fullWidth: boolean;
1412
href?: string;
15-
size?: 'large' | 'medium' | 'small';
16-
startIcon?: string;
17-
startIconTheme?: 'Filled' | 'Outlined' | 'Rounded' | 'TwoTone' | 'Sharp';
18-
endIconTheme?: 'Filled' | 'Outlined' | 'Rounded' | 'TwoTone' | 'Sharp';
19-
label?: string;
20-
width?: number;
21-
height?: number;
13+
size: 'large' | 'medium' | 'small';
14+
startIcon: string;
15+
startIconTheme: 'Filled' | 'Outlined' | 'Rounded' | 'TwoTone' | 'Sharp';
16+
endIconTheme: 'Filled' | 'Outlined' | 'Rounded' | 'TwoTone' | 'Sharp';
17+
label: string;
18+
width: number | string;
19+
height: number;
2220
variant?: 'contained' | 'outlined' | 'text';
2321
}
2422

25-
const defaultProps: Props = {
26-
color: 'primary',
27-
disabled: false,
28-
disableElevation: false,
29-
endIcon: undefined,
30-
fullWidth: false,
31-
size: 'medium',
32-
startIcon: undefined,
33-
startIconTheme: 'Filled',
34-
endIconTheme: 'Filled',
35-
label: 'Button',
36-
width: 100,
37-
height: 38,
38-
variant: 'text',
39-
};
40-
41-
export const Button: React.SFC<Props> = (props: Props) => {
23+
export function Button(props: Props): JSX.Element {
4224
const {
4325
endIcon,
4426
endIconTheme,
@@ -61,9 +43,23 @@ export const Button: React.SFC<Props> = (props: Props) => {
6143
</MuiButton>
6244
</div>
6345
);
64-
};
46+
}
6547

66-
Button.defaultProps = defaultProps;
48+
Button.defaultProps = {
49+
color: 'primary' as 'primary',
50+
disabled: false,
51+
disableElevation: false,
52+
endIcon: undefined,
53+
fullWidth: false,
54+
size: 'medium' as 'medium',
55+
startIcon: undefined,
56+
startIconTheme: 'Filled' as 'Filled',
57+
endIconTheme: 'Filled' as 'Filled',
58+
label: 'Button',
59+
width: 100,
60+
height: 38,
61+
variant: 'text' as 'text',
62+
};
6763

6864
addPropertyControls(Button, {
6965
color: {

0 commit comments

Comments
 (0)