From 9ff003bec107a4934daf2a3cee73c40ec72e6999 Mon Sep 17 00:00:00 2001 From: Eug-VS Date: Mon, 3 Feb 2020 16:31:48 +0300 Subject: feat: migrate SmartList to Typescript --- src/lib/SmartList/SmartList.js | 28 -------------------------- src/lib/SmartList/SmartList.tsx | 44 +++++++++++++++++++++++++++++++++++++++++ src/lib/index.js | 5 ----- src/lib/index.ts | 5 +++++ 4 files changed, 49 insertions(+), 33 deletions(-) delete mode 100644 src/lib/SmartList/SmartList.js create mode 100644 src/lib/SmartList/SmartList.tsx delete mode 100644 src/lib/index.js create mode 100644 src/lib/index.ts (limited to 'src/lib') diff --git a/src/lib/SmartList/SmartList.js b/src/lib/SmartList/SmartList.js deleted file mode 100644 index b462c47..0000000 --- a/src/lib/SmartList/SmartList.js +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react'; - -import { FixedSizeList } from 'react-window'; -import AutoSizer from 'react-virtualized-auto-sizer'; - - -const SmartList = ({ itemSize, itemCount, renderItem }) => { - - return ( -
- - {({ width, height }) => ( - - {renderItem} - - )} - -
- ); -}; - - -export default SmartList; diff --git a/src/lib/SmartList/SmartList.tsx b/src/lib/SmartList/SmartList.tsx new file mode 100644 index 0000000..c889719 --- /dev/null +++ b/src/lib/SmartList/SmartList.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { FixedSizeList } from 'react-window'; +import AutoSizer from 'react-virtualized-auto-sizer'; + + +interface RenderPropTypes { + index: number; + style: any; +} + +interface PropTypes { + itemSize: number; + itemCount: number; + renderItem: React.FC; +} + +interface Size { + height: number; + width: number; +} + + +const SmartList: React.FC = ({ itemSize, itemCount, renderItem }) => { + + const ResizedList: React.FC = ({ width, height}) => ( + + {renderItem} + + ); + + return ( +
+ +
+ ); +}; + + +export default SmartList; diff --git a/src/lib/index.js b/src/lib/index.js deleted file mode 100644 index 67f9bb4..0000000 --- a/src/lib/index.js +++ /dev/null @@ -1,5 +0,0 @@ -export { default as Window } from './Window/Window'; -export { default as Header } from './Header/Header'; -export { default as ContentSection } from './ContentSection/ContentSection'; -export { default as SmartList } from './SmartList/SmartList'; -export { default as BenzinThemeProvider } from './BenzinThemeProvider/BenzinThemeProvider'; diff --git a/src/lib/index.ts b/src/lib/index.ts new file mode 100644 index 0000000..67f9bb4 --- /dev/null +++ b/src/lib/index.ts @@ -0,0 +1,5 @@ +export { default as Window } from './Window/Window'; +export { default as Header } from './Header/Header'; +export { default as ContentSection } from './ContentSection/ContentSection'; +export { default as SmartList } from './SmartList/SmartList'; +export { default as BenzinThemeProvider } from './BenzinThemeProvider/BenzinThemeProvider'; -- cgit v1.2.3