From 6ba958fafa6108289d86dabb6e1410b611d3187c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Ytterstr=C3=B6m?= Date: Thu, 5 Mar 2020 18:09:48 +0100 Subject: [PATCH] Replace interfaces with Types --- src/components/album-list.tsx | 6 +++--- src/components/album.tsx | 11 ++++++----- src/components/filter-input.tsx | 6 +++--- src/components/modal.tsx | 12 ++++++------ src/components/sort-select.tsx | 6 +++--- src/containers/modal.ts | 1 - src/containers/sort-select.ts | 1 - src/reducers/albums.ts | 6 +++--- src/reducers/index.ts | 12 ++++++++++++ src/reducers/selected-album.ts | 6 +++--- src/reducers/sort-key.ts | 6 +++--- src/reducers/visibility-filter.ts | 6 +++--- 12 files changed, 45 insertions(+), 34 deletions(-) diff --git a/src/components/album-list.tsx b/src/components/album-list.tsx index 9b9b11c..0b8914c 100644 --- a/src/components/album-list.tsx +++ b/src/components/album-list.tsx @@ -2,7 +2,7 @@ import React from "react"; import Album from "./album"; import * as interfaces from "../interfaces"; -export default (props: AlbumList) => { +export default (props: Props) => { const { albums, handleOnClick, blurred } = props; const classNames = blurred ? "blur" : ""; return ( @@ -18,8 +18,8 @@ export default (props: AlbumList) => { ); }; -interface AlbumList { +type Props = { albums: Array; handleOnClick: Function; blurred: boolean; -} +}; diff --git a/src/components/album.tsx b/src/components/album.tsx index 8c8614f..30eb3df 100644 --- a/src/components/album.tsx +++ b/src/components/album.tsx @@ -1,7 +1,7 @@ import React from "react"; -import * as interfaces from "../interfaces"; +import { Album } from "../interfaces"; -export default (props: Album) => { +export default (props: Props) => { const handleKeyPress = (e: KeyboardEvent, callback: Function) => { const SPACE_KEY = 32; const ENTER_KEY = 13; @@ -37,7 +37,8 @@ export default (props: Album) => { ); }; -interface Album { - album: interfaces.Album; +type Props = { + key: number; + album: Album; handleOnClick: Function; -} +}; diff --git a/src/components/filter-input.tsx b/src/components/filter-input.tsx index 701bcdd..55e1782 100644 --- a/src/components/filter-input.tsx +++ b/src/components/filter-input.tsx @@ -1,6 +1,6 @@ import React from "react"; -export default (props: FilterInput) => { +export default (props: Props) => { const { value, handleOnChange } = props; return (
@@ -14,7 +14,7 @@ export default (props: FilterInput) => { ); }; -interface FilterInput { +type Props = { value: string; handleOnChange: Function; -} +}; diff --git a/src/components/modal.tsx b/src/components/modal.tsx index fd103a9..bebd3af 100644 --- a/src/components/modal.tsx +++ b/src/components/modal.tsx @@ -1,12 +1,7 @@ import React from "react"; import { Album } from "../interfaces"; -interface Modal { - album: Album; - handleOnClick: Function; -} - -export default (props: Modal) => { +export default (props: Props) => { const handleKeyPress = (e: KeyboardEvent, callback: Function) => { console.log(e.charCode); callback(); @@ -40,3 +35,8 @@ export default (props: Modal) => {
); }; + +type Props = { + album: Album; + handleOnClick(): void; +}; diff --git a/src/components/sort-select.tsx b/src/components/sort-select.tsx index a3b9814..b0f8378 100644 --- a/src/components/sort-select.tsx +++ b/src/components/sort-select.tsx @@ -1,6 +1,6 @@ import React from "react"; -export default (props: SortSelect) => { +export default (props: Props) => { const { value, handleOnChange } = props; return (