-
-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#164] Added 'zoomToCenter' function.
- Loading branch information
1 parent
a6de905
commit d214e64
Showing
29 changed files
with
1,281 additions
and
1,204 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import React, { Component } from 'react'; | ||
import Item from './Item'; | ||
|
||
export interface BoxProps extends React.HTMLAttributes<any> { | ||
display?: 'flex' | 'inline-flex'; | ||
flexDirection?: 'column-reverse' | 'column' | 'row-reverse' | 'row'; | ||
flexWrap?: 'nowrap' | 'wrap-reverse' | 'wrap'; | ||
flexFlow?: string; | ||
justifyContent?: 'center' | 'flex-end' | 'flex-start' | 'space-around' | 'space-between' | 'space-evenly'; | ||
alignItems?: 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch'; | ||
alignContent?: 'center' | 'flex-end' | 'flex-start' | 'space-around' | 'space-between' | 'stretch'; | ||
alignSelf?: 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch'; | ||
order?: number; | ||
flexGrow?: number | string; | ||
flexShrink?: number | string; | ||
flexBasis?: number | string; | ||
flex?: number | string; | ||
} | ||
|
||
class Flex extends Component<BoxProps> { | ||
static Item: typeof Item; | ||
|
||
render() { | ||
const { | ||
flexDirection, | ||
flexWrap, | ||
flexFlow, | ||
justifyContent, | ||
alignItems, | ||
alignContent, | ||
alignSelf, | ||
order, | ||
flexGrow, | ||
flexShrink, | ||
flexBasis, | ||
flex, | ||
style, | ||
children, | ||
...other | ||
} = this.props; | ||
const newStyle = Object.assign( | ||
{}, | ||
{ | ||
display: 'flex', | ||
flexDirection, | ||
flexWrap, | ||
flexFlow, | ||
justifyContent, | ||
alignItems, | ||
alignContent, | ||
alignSelf, | ||
order, | ||
flexGrow, | ||
flexShrink, | ||
flexBasis, | ||
flex, | ||
}, | ||
style, | ||
) as any; | ||
return ( | ||
<div | ||
style={Object.keys(newStyle).reduce((prev, key) => { | ||
if (newStyle[key]) { | ||
return Object.assign(prev, { [key]: newStyle[key] }); | ||
} | ||
return prev; | ||
}, {})} | ||
{...other} | ||
> | ||
{children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
Flex.Item = Item; | ||
|
||
export default Flex; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
|
||
export interface ItemProps extends React.HTMLAttributes<any> { | ||
alignSelf?: 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch'; | ||
order?: number; | ||
flexGrow?: number | string; | ||
flexShrink?: number | string; | ||
flexBasis?: number | string; | ||
flex?: number | string; | ||
} | ||
|
||
const Item: React.SFC<ItemProps> = props => { | ||
const { alignSelf, order, flexGrow, flexShrink, flexBasis, flex, style, children, ...other } = props; | ||
const newStyle = Object.assign( | ||
{}, | ||
{ | ||
alignSelf, | ||
order, | ||
flexGrow, | ||
flexShrink, | ||
flexBasis, | ||
flex, | ||
}, | ||
style, | ||
) as any; | ||
return ( | ||
<div | ||
style={Object.keys(newStyle).reduce((prev, key) => { | ||
if (newStyle[key]) { | ||
return Object.assign(prev, { [key]: newStyle[key] }); | ||
} | ||
return prev; | ||
}, {})} | ||
{...other} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Item; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Flex } from './Flex'; |
Oops, something went wrong.