-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathImageHorizontal.js
53 lines (49 loc) · 1.28 KB
/
ImageHorizontal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// example Layout.js
import React from "react";
import { styled, withTheme } from "styled-components";
import PropTypes from "prop-types";
import ImageIcon from "./ImageIcon";
import Flex from "./Flex";
import Box from "./Box";
export default withTheme(
class ImageHorizontal extends React.Component {
static propTypes = {
children: PropTypes.string,
className: PropTypes.string,
theme: PropTypes.object
};
constructor(props) {
super(props);
}
render() {
const { className, children, theme } = this.props;
const kids = React.Children.toArray(children)
const numberOfChildren = kids.length;
return (
<Flex
css={{
flexDirection: "row",
flexFlow: "nowrap",
alignItems: "center",
width: "100%",
overflow: "hidden",
margin: "0px 0px 10px 0px",
padding: "0px 0px 0px 0px"
}}
>
{kids.map(k => (
<Box
key={k.key}
width={1 / numberOfChildren}
css={{
padding: "0px 5px 0px 5px"
}}
>
{k}
</Box>
))}
</Flex>
);
}
}
);