diff --git a/package-lock.json b/package-lock.json index b1aebcd..6a3b3f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5896,12 +5896,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5916,17 +5918,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6043,7 +6048,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6055,6 +6061,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6069,6 +6076,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6076,12 +6084,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6100,6 +6110,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6180,7 +6191,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -6192,6 +6204,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -6313,6 +6326,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/assets/images/test-image.jpg b/src/assets/images/test-image.jpg new file mode 100644 index 0000000..80f0254 Binary files /dev/null and b/src/assets/images/test-image.jpg differ diff --git a/src/components/image/Image/index.js b/src/components/image/Image/index.js new file mode 100644 index 0000000..f97b97a --- /dev/null +++ b/src/components/image/Image/index.js @@ -0,0 +1,41 @@ +import React from 'react' +import styled, { css } from 'styled-components' +import PropTypes from 'prop-types' + +import borderRadius from 'mixins/borderRadius' + +function applyImageStyles ({ radius }) { + return css` + border-radius: ${radius}; + ` +} + +const StyledImage = styled.img` + ${applyImageStyles}; +` + +const Image = ({ src, alt, radius, width, height }) => ( + +) + +Image.defaultProps = { + radius: borderRadius.image, + height: 142, + width: 142, +} + +Image.propTypes = { + src: PropTypes.string.isRequired, + alt: PropTypes.string, + width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + radius: PropTypes.string, +} + +export default Image diff --git a/src/index.js b/src/index.js index 689a1fa..1c6c983 100644 --- a/src/index.js +++ b/src/index.js @@ -3,3 +3,5 @@ export { default as CoreStyle } from 'core' export { default as Button } from 'components/button/Button' export { default as FacebookButton } from 'components/button/FacebookButton' + +export { default as Image } from 'components/image/Image' diff --git a/src/mixins/borderRadius/index.js b/src/mixins/borderRadius/index.js new file mode 100644 index 0000000..5075233 --- /dev/null +++ b/src/mixins/borderRadius/index.js @@ -0,0 +1,3 @@ +export default { + image: '16px', +} diff --git a/stories/Image/NormalImage.js b/stories/Image/NormalImage.js new file mode 100644 index 0000000..d380914 --- /dev/null +++ b/stories/Image/NormalImage.js @@ -0,0 +1,8 @@ +import React from 'react' +import Image from 'components/image/Image' + +const testImage = require('assets/images/test-image.jpg') + +const NormalImage = () => + +export default NormalImage diff --git a/stories/Image/index.js b/stories/Image/index.js new file mode 100644 index 0000000..d316bc4 --- /dev/null +++ b/stories/Image/index.js @@ -0,0 +1,6 @@ +import baseStory from 'stories/utils/baseStory' + +baseStory('Image', module).addWithJSX( + 'Normal Image', + require('./NormalImage').default, +) diff --git a/stories/index.js b/stories/index.js index ad602e2..38aaed8 100644 --- a/stories/index.js +++ b/stories/index.js @@ -1,3 +1,4 @@ require('./Typography') require('./Color') require('./Button') +require('./Image') diff --git a/webpack.config.js b/webpack.config.js index 94ecb72..b0a9665 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -17,7 +17,7 @@ module.exports = { use: 'babel-loader', }, { - test: /\.(eot|svg|ttf|woff|woff2|otf)$/, + test: /\.(eot|svg|ttf|woff|woff2|otf|jpg|png)$/, loader: 'file-loader', }, ],