Skip to content

Commit

Permalink
feat: svg images imported and whitespace removed
Browse files Browse the repository at this point in the history
  • Loading branch information
yjb94 committed Jan 22, 2020
1 parent 4939f22 commit de3f8c6
Show file tree
Hide file tree
Showing 82 changed files with 174 additions and 15 deletions.
62 changes: 62 additions & 0 deletions MobileStoreButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import PropTypes from 'prop-types';

const imageLinks = {
ios: 'https://linkmaker.itunes.apple.com/images/badges/en-us/badge_appstore-lrg.svg',
android: 'https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png',
};

class MobileStoreButton extends React.Component {
static propTypes = {
store: PropTypes.oneOf(['ios', 'android']).isRequired,
url: PropTypes.string.isRequired,
height: PropTypes.number,
width: PropTypes.number,
linkStyles: PropTypes.object,
linkProps: PropTypes.object,
};
static defaultProps = {
height: 75,
width: 255,
};

render() {
const {
store,
url,
height,
width,
linkStyles,
linkProps,
...props
} = this.props;

const defaultLinkStyles = {
background: `url(${imageLinks[store]}) no-repeat`,
backgroundSize: 'contain',
display: 'inline-block',
overflow: 'hidden',
textDecoration: 'none',
height: '100%',
width: '100%',
padding: '5px',
...linkStyles,
};

return (
<div style={{ height, width, display: 'inline-block' }} {...props}>
<a
style={defaultLinkStyles}
href={url}
target="_blank"
rel="noopener noreferrer"
{...linkProps}
>
&nbsp;
</a>
</div>
);
}
}

export default MobileStoreButton;
13 changes: 10 additions & 3 deletions demo/src/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import React, {Component} from 'react'
import {render} from 'react-dom'

import Example from '../../src'
import ReactStoreBadges from '../../src'

class Demo extends Component {
render() {
return <div>
<h1>react-store-badges Demo</h1>
<Example/>
<ReactStoreBadges
platfrom={'ios'}
url={'https://apps.apple.com/app/kpop-speed-quiz/id1463167156'}
/>

<ReactStoreBadges
platfrom={'android'}
url={'https://play.google.com/store/apps/details?id=com.stayge.speedquiz'}
/>
</div>
}
}
Expand Down
1 change: 1 addition & 0 deletions img/playstore/af_get.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/playstore/am_get.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit de3f8c6

Please sign in to comment.