@propellerads/ad-format
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -1,3 +0,7 @@ | ||
### `1.0.1` | ||
#### `1.1.0` | ||
* Remove `size` property. | ||
#### `1.0.1` | ||
* Add Native Widget animation & preview. |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
StyledAdFormat, | ||
StyledPreview, | ||
SIZES, | ||
PREVIEWS, | ||
@@ -14,3 +14,2 @@ FORMATS, | ||
name, | ||
size, | ||
classNames, | ||
@@ -22,31 +21,18 @@ isPreview, | ||
<StyledPreview | ||
size={size} | ||
name={name} | ||
className={classNames} | ||
/> | ||
) : <div />; | ||
) : null; | ||
} | ||
return (SVGS | ||
&& <StyledAdFormat size={size} classNames={classNames} dangerouslySetInnerHTML={{__html: SVGS[name]}} />); | ||
return SVGS[name] ? ( | ||
<StyledAdFormat | ||
className={classNames} | ||
dangerouslySetInnerHTML={{__html: SVGS[name]}} | ||
/> | ||
) : null; | ||
}; | ||
export const componentProps = { | ||
size: [ | ||
SIZES.EXTRA_SMALL, | ||
SIZES.SMALL, | ||
SIZES.MEDIUM, | ||
SIZES.LARGE, | ||
SIZES.EXTRA_LARGE, | ||
], | ||
ads: [ | ||
FORMATS.INTERSTITIAL, | ||
FORMATS.NATIVE, FORMATS.ONCLICK, | ||
FORMATS.NATIVEADS, FORMATS.LINK, | ||
FORMATS.DIRECT_LINK, | ||
FORMATS.PUSH_LINK, | ||
FORMATS.WEBSITE, | ||
FORMATS.LANDING_PAGE, | ||
FORMATS.IN_PAGE_PUSH, | ||
FORMATS.NATIVE_WIDGET, | ||
], | ||
ads: Object.values(FORMATS), | ||
}; | ||
@@ -56,3 +42,2 @@ | ||
name: PropTypes.oneOf(componentProps.ads).isRequired, | ||
size: PropTypes.oneOf(componentProps.size), | ||
classNames: PropTypes.string, | ||
@@ -63,3 +48,2 @@ isPreview: PropTypes.bool, | ||
AdFormat.defaultProps = { | ||
size: SIZES.MEDIUM, | ||
classNames: '', | ||
@@ -75,3 +59,2 @@ isPreview: false, | ||
PREVIEWS, | ||
SIZES, | ||
}; |
{ | ||
"name": "@propellerads/ad-format", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"main": "index.jsx", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/propellerads/ui-components", |
@@ -23,12 +23,2 @@ import styled, {css} from 'styled-components'; | ||
const item = 210; | ||
const SIZES = { | ||
EXTRA_SMALL: 'extra_small', | ||
SMALL: 'small', | ||
MEDIUM: 'medium', | ||
LARGE: 'large', | ||
EXTRA_LARGE: 'extra_large', | ||
}; | ||
const FORMATS = { | ||
@@ -72,45 +62,10 @@ INTERSTITIAL: 'interstitial', | ||
const extraSmallStyle = css` | ||
width: ${item / 3}px; | ||
height: ${item / 3}px; | ||
`; | ||
const smallStyle = css` | ||
width: ${item / 2}px; | ||
height: ${item / 2}px; | ||
`; | ||
const mediumStyle = css` | ||
width: ${item}px; | ||
height: ${item}px; | ||
`; | ||
const largeStyle = css` | ||
width: ${item * 2}px; | ||
height: ${item * 2}px; | ||
`; | ||
const extraLargeStyle = css` | ||
width: ${item * 3}px; | ||
height: ${item * 3}px; | ||
`; | ||
const StyledAdFormat = styled.div` | ||
display: inline-block; | ||
${(props) => props.size === SIZES.EXTRA_SMALL && extraSmallStyle} | ||
${(props) => props.size === SIZES.SMALL && smallStyle} | ||
${(props) => props.size === SIZES.MEDIUM && mediumStyle} | ||
${(props) => props.size === SIZES.LARGE && largeStyle} | ||
${(props) => props.size === SIZES.EXTRA_LARGE && extraLargeStyle} | ||
`; | ||
const StyledPreview = styled.img.attrs({ | ||
src: (props) => PREVIEWS[props.name], | ||
alt: (props) => `${props.name} ad format`, | ||
className: (props) => props.className, | ||
})` | ||
width: 210px; | ||
height: 136px; | ||
`; | ||
const StyledPreview = styled.img.attrs(props => ({ | ||
src: PREVIEWS[props.name], | ||
alt: `${props.name} ad format`, | ||
}))``; | ||
@@ -120,3 +75,2 @@ export { | ||
StyledPreview, | ||
SIZES, | ||
PREVIEWS, | ||
@@ -123,0 +77,0 @@ FORMATS, |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
100702
115