Skip to content

Commit 1cf073a

Browse files
committed
Use types instead of interfaces
1 parent 7b9761f commit 1cf073a

File tree

17 files changed

+59
-64
lines changed

17 files changed

+59
-64
lines changed

src/Dashboard/Dashboard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import KeyMetrics from './KeyMetrics/'
1111
import SubscriptionsRecent from './SubscriptionsRecent/'
1212
import SubscriptionsBreakdown from './SubscriptionsBreakdown/'
1313

14-
const Dashboard: React.FC = () => {
14+
export type DashboardProps = {}
15+
16+
const Dashboard: React.FC<DashboardProps> = () => {
1517
return (
1618
<BasePageContainer>
1719
<BasePageToolbar title={'Dashboard'} ActionsComponent={DashboardActions} />

src/Dashboard/KeyMetrics/KeyMetrics.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ const keyMetrics = [
5656
},
5757
]
5858

59-
const KeyMetrics: React.FC = () => {
59+
export type KeyMetricsProps = {}
60+
61+
const KeyMetrics: React.FC<KeyMetricsProps> = () => {
6062
const classes = useStyles()
6163

6264
return (
@@ -104,8 +106,6 @@ const KeyMetrics: React.FC = () => {
104106
)
105107
}
106108

107-
KeyMetrics.propTypes = {}
108-
109109
const useStyles = makeStyles((theme) => ({
110110
root: {
111111
flexGrow: 1,

src/Dashboard/SubscriptionsBreakdown/SubscriptionsBreakdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import { Bar } from 'react-chartjs-2'
1212

1313
import { chart } from './data'
1414

15-
const SubscriptionsBreakdown = () => {
15+
export type SubscriptionsBreakdownProps = {}
16+
17+
const SubscriptionsBreakdown: React.FC<SubscriptionsBreakdownProps> = () => {
1618
const classes = useStyles()
1719

1820
return (
@@ -40,8 +42,6 @@ const SubscriptionsBreakdown = () => {
4042
)
4143
}
4244

43-
SubscriptionsBreakdown.propTypes = {}
44-
4545
const useStyles = makeStyles((theme) => ({
4646
card: {
4747
height: '100%',

src/Dashboard/SubscriptionsHistory/SubscriptionsHistory.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import { Line } from 'react-chartjs-2'
1414

1515
import { subscriptionsItems, subscriptionsHistoryChart } from './data'
1616

17-
const Subscriptions: React.FC = () => {
17+
export type SubscriptionsProps = {}
18+
19+
const Subscriptions: React.FC<SubscriptionsProps> = () => {
1820
const classes = useStyles()
1921

2022
return (

src/Dashboard/SubscriptionsRecent/SubscriptionsRecent.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import { FormattedDate } from 'react-intl'
2020

2121
import { recentSubscriptions } from './data'
2222

23-
const Subscriptions = () => {
23+
export type SubscriptionsRecentProps = {}
24+
25+
const SubscriptionsRecent: React.FC<SubscriptionsRecentProps> = () => {
2426
const classes = useStyles()
2527

2628
return (
@@ -78,8 +80,6 @@ const Subscriptions = () => {
7880
)
7981
}
8082

81-
Subscriptions.propTypes = {}
82-
8383
const useStyles = makeStyles((theme) => ({
8484
card: {
8585
height: '100%',
@@ -102,4 +102,4 @@ const useStyles = makeStyles((theme) => ({
102102
},
103103
}))
104104

105-
export default Subscriptions
105+
export default SubscriptionsRecent

src/_common/AppFooter/AppFooter.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import Link from '@material-ui/core/Link'
44
import { makeStyles } from '@material-ui/core/styles'
55
import pkg from '../../../package.json'
66

7-
const Footer: React.FC = () => {
7+
type AppFooterProps = {}
8+
9+
const AppFooter: React.FC<AppFooterProps> = () => {
810
const classes = useStyles()
911

1012
return (
@@ -57,4 +59,4 @@ const useStyles = makeStyles((theme) => ({
5759
},
5860
}))
5961

60-
export default Footer
62+
export default AppFooter

src/_common/AppHeader/AppHeader.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ import Toolbar from '@material-ui/core/Toolbar'
77
import IconButton from '@material-ui/core/IconButton'
88
import IconMenu from '@material-ui/icons/Menu'
99

10-
import { ITheme } from '_theme/'
11-
1210
import HeaderDemo from './AppHeaderDemoButtons'
1311
import HeaderProfile from './AppHeaderProfile'
1412
// import HeaderSearch from './AppHeaderSearch'
1513
// import HeaderNotifications from './AppHeaderNotifications'
1614

17-
export interface IAppHeader {
15+
export type AppHeaderProps = {
1816
onToggleClick(): void
1917
}
2018

21-
const AppHeader: React.FC<IAppHeader> = ({ onToggleClick }) => {
19+
const AppHeader: React.FC<AppHeaderProps> = ({ onToggleClick }) => {
2220
const classes = useStyles()
2321

2422
return (
@@ -42,7 +40,7 @@ const AppHeader: React.FC<IAppHeader> = ({ onToggleClick }) => {
4240
)
4341
}
4442

45-
const useStyles = makeStyles<ITheme>((theme) => ({
43+
const useStyles = makeStyles((theme) => ({
4644
header: {
4745
background: '#fff',
4846
color: '#7b7b7b',

src/_common/AppHeader/AppHeaderNotifications.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import ListItemAvatar from '@material-ui/core/ListItemAvatar'
1212
import Avatar from '@material-ui/core/Avatar'
1313
import Typography from '@material-ui/core/Typography'
1414

15-
import { ITheme } from '_theme/'
15+
import { Theme } from '_theme/'
1616

1717
const notifications = [
1818
{
@@ -41,7 +41,9 @@ const notifications = [
4141
},
4242
]
4343

44-
const AppHeaderNotifications: React.FC = () => {
44+
export type AppHeaderNotificationsProps = {}
45+
46+
const AppHeaderNotifications: React.FC<AppHeaderNotificationsProps> = () => {
4547
const classes = useStyles()
4648
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement>()
4749

@@ -122,7 +124,7 @@ const AppHeaderNotifications: React.FC = () => {
122124
// return <List className={classes.notifications}></List>
123125
// }
124126

125-
const useStyles = makeStyles<ITheme>((theme) => ({
127+
const useStyles = makeStyles((theme) => ({
126128
headerNotifications: {
127129
marginRight: 23,
128130
// position: 'relative',

src/_common/AppSidebar/AppSidebar.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ import { makeStyles } from '@material-ui/core/styles'
44
import { Link } from 'react-router-dom'
55
import Typography from '@material-ui/core/Typography'
66

7-
// import AppSidebarBg from './AppSidebarBg.jpg'
8-
import { ITheme } from '_theme/'
97
import BaseLogo from '_common/BaseLogo'
108
import SidebarNav from './SidebarNav'
119

12-
export interface ISidebarProps {
10+
export type AppSidebarProps = {
1311
isCollapsed?: boolean
1412
}
1513

16-
const Sidebar: React.FC<ISidebarProps> = (props) => {
14+
const Sidebar: React.FC<AppSidebarProps> = (props) => {
1715
// const { isCollapsed } = props
1816

1917
const classes = useStyles(props)
@@ -56,7 +54,7 @@ Sidebar.defaultProps = {
5654
// isCollapsed: PropTypes.bool,
5755
// }
5856

59-
const useStyles = makeStyles<ITheme>((theme) => ({
57+
const useStyles = makeStyles((theme) => ({
6058
sidebar: {
6159
position: 'absolute',
6260
top: 0,
@@ -104,7 +102,7 @@ const useStyles = makeStyles<ITheme>((theme) => ({
104102
color: theme.palette.primary.main,
105103
zIndex: 10,
106104
},
107-
title: (props: ISidebarProps) => ({
105+
title: (props: AppSidebarProps) => ({
108106
position: 'relative',
109107
overflow: 'visible',
110108
marginLeft: '5px',

src/_common/AppSidebar/SidebarNav/SidebarNav.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ import { makeStyles, createStyles } from '@material-ui/core/styles'
33
import List from '@material-ui/core/List'
44
import ListSubheader from '@material-ui/core/ListSubheader'
55

6-
import { ITheme } from '_theme'
76
import { itemsCore /*, itemsTheme */ } from './SidebarNavService'
8-
import SidebarNavListItem, { ISidebarNavListItem } from './SidebarNavListItem'
7+
import SidebarNavListItem, { SidebarNavListItemProps } from './SidebarNavListItem'
98

10-
export interface ISidebarNavProps {
9+
export type SidebarNavProps = {
1110
// isCollapsed?: boolean
1211
}
1312

14-
const SidebarNav: React.FC<ISidebarNavProps> = (props) => {
13+
const SidebarNav: React.FC<SidebarNavProps> = (props) => {
1514
// const { isCollapsed } = props
1615
const classes = useStyles()
1716

@@ -23,7 +22,7 @@ const SidebarNav: React.FC<ISidebarNavProps> = (props) => {
2322
</ListSubheader>
2423
</List>
2524

26-
{itemsCore.map((item: ISidebarNavListItem) => {
25+
{itemsCore.map((item: SidebarNavListItemProps) => {
2726
return <SidebarNavListItem {...item} key={item.name} />
2827
})}
2928

@@ -36,7 +35,7 @@ const SidebarNav: React.FC<ISidebarNavProps> = (props) => {
3635
)
3736
}
3837

39-
const useStyles = makeStyles<ITheme>((theme) =>
38+
const useStyles = makeStyles((theme) =>
4039
createStyles({
4140
navList: {
4241
width: theme.sidebar.width,

0 commit comments

Comments
 (0)