diff --git a/example/example.ts b/example/example.ts index 3c02407..dc170f1 100644 --- a/example/example.ts +++ b/example/example.ts @@ -1,131 +1,131 @@ export default [ { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 1 + columns: 1, }, { - "columns": 2 + columns: 2, }, { - "columns": 2 + columns: 2, }, { - "columns": 2 + columns: 2, }, { - "columns": 2 + columns: 2, }, { - "columns": 2 + columns: 2, }, { - "columns": 2 + columns: 2, }, { - "columns": 3 + columns: 3, }, { - "columns": 3 + columns: 3, }, { - "columns": 3 + columns: 3, }, { - "columns": 3 + columns: 3, }, { - "columns": 4 + columns: 4, }, { - "columns": 4 + columns: 4, }, { - "columns": 4 + columns: 4, }, { - "columns": 5 + columns: 5, }, { - "columns": 7 + columns: 7, }, { - "columns": 6 + columns: 6, }, { - "columns": 6 + columns: 6, }, { - "columns": 4 + columns: 4, }, { - "columns": 8 + columns: 8, }, { - "columns": 3 + columns: 3, }, { - "columns": 9 + columns: 9, }, { - "columns": 2 + columns: 2, }, { - "columns": 10 + columns: 10, }, { - "columns": 1 + columns: 1, }, { - "columns": 11 + columns: 11, }, { - "columns": 12 + columns: 12, }, { - "columns": 4 + columns: 4, }, { - "columns": 4 + columns: 4, }, { - "columns": 4 + columns: 4, }, { - "columns": 4 + columns: 4, }, { - "columns": 4 - } -] \ No newline at end of file + columns: 4, + }, +]; diff --git a/example/index.tsx b/example/index.tsx index 864d041..bf254fd 100644 --- a/example/index.tsx +++ b/example/index.tsx @@ -1,42 +1,43 @@ import 'react-app-polyfill/ie11'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { Flex, Item } from '../.' -import myList from './example' +import { Flex, Item } from '../.'; +import myList from './example'; const App = () => (
-

Example

- - {myList.map(({ columns }, i: number) => ( - -
+

Example

+ + {myList.map(({ columns }, i: number) => ( + -

{columns}

-
-
- ))} -
-
-) +
+

{columns}

+
+ + ))} + +

Hello

+ +); ReactDOM.render(, document.getElementById('root')); diff --git a/package.json b/package.json index e45dfe4..950f991 100644 --- a/package.json +++ b/package.json @@ -41,11 +41,11 @@ "size-limit": [ { "path": "dist/react-flex-ready.cjs.production.min.js", - "limit": "10 KB" + "limit": "16 KB" }, { "path": "dist/react-flex-ready.esm.js", - "limit": "10 KB" + "limit": "16 KB" } ], "devDependencies": { diff --git a/src/Flex.ts b/src/Flex.tsx similarity index 56% rename from src/Flex.ts rename to src/Flex.tsx index 9a27fb0..4c01503 100644 --- a/src/Flex.ts +++ b/src/Flex.tsx @@ -1,7 +1,9 @@ +import * as React from 'react'; import styled from 'styled-components'; import { FlexProps } from './interfaces'; +import Item from './Item'; -const Flex = styled.div` +const StyledFlex = styled.div>` display: flex; justify-content: ${({ justifyContent }) => justifyContent || 'space-between'}; flex-wrap: wrap; @@ -29,4 +31,34 @@ const Flex = styled.div` } `; +const Flex: React.FC = ({ + children, + col, + colTablet, + colMobile, + gap, + gabTablet, + gapMobile, + align, + justifyContent, + className, + style, +}) => ( + + {children} + + +); + export default Flex; diff --git a/src/interfaces.ts b/src/interfaces.ts index 21fc978..b23e29d 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -14,7 +14,7 @@ export interface ItemProps extends HTMLAttributes { style?: object; } -export interface FlexProps extends HTMLAttributes { +export interface FlexProps { gap?: number; gabTablet?: number; gapMobile?: number; @@ -23,7 +23,6 @@ export interface FlexProps extends HTMLAttributes { col?: number; colTablet?: number; colMobile?: number; - as?: string | Component; className?: string; style?: object; }