Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions .bitmap
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/avatar@0.0.8": {
"campgladiator.cgui/components/atoms/avatar@0.0.9": {
"files": [
{
"name": "Avatar.js",
Expand Down Expand Up @@ -115,7 +115,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/button@0.0.14": {
"campgladiator.cgui/components/atoms/button@0.0.15": {
"files": [
{
"name": "Button.js",
Expand Down Expand Up @@ -143,7 +143,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/callout@0.0.5": {
"campgladiator.cgui/components/atoms/callout@0.0.6": {
"files": [
{
"name": "Callout.js",
Expand Down Expand Up @@ -204,7 +204,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/checkbox@0.0.9": {
"campgladiator.cgui/components/atoms/checkbox@0.0.10": {
"files": [
{
"name": "Checkbox.js",
Expand Down Expand Up @@ -265,7 +265,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/dropdown@0.0.5": {
"campgladiator.cgui/components/atoms/dropdown@0.0.6": {
"files": [
{
"name": "Dropdown.js",
Expand Down Expand Up @@ -293,7 +293,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/fieldset@0.0.10": {
"campgladiator.cgui/components/atoms/fieldset@0.0.11": {
"files": [
{
"name": "Fieldset.js",
Expand Down Expand Up @@ -321,7 +321,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/form-label@0.0.10": {
"campgladiator.cgui/components/atoms/form-label@0.0.11": {
"files": [
{
"name": "FormLabel.js",
Expand Down Expand Up @@ -349,7 +349,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/growl@0.0.5": {
"campgladiator.cgui/components/atoms/growl@0.0.6": {
"files": [
{
"name": "Growl.js",
Expand Down Expand Up @@ -377,7 +377,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/heading@0.0.4": {
"campgladiator.cgui/components/atoms/heading@0.0.5": {
"files": [
{
"name": "Heading.js",
Expand Down Expand Up @@ -410,7 +410,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/icon@0.0.4": {
"campgladiator.cgui/components/atoms/icon@0.0.5": {
"files": [
{
"name": "Icon.js",
Expand Down Expand Up @@ -438,7 +438,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/image-label@0.0.4": {
"campgladiator.cgui/components/atoms/image-label@0.0.5": {
"files": [
{
"name": "ImageLabel.js",
Expand Down Expand Up @@ -466,7 +466,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/input@0.0.11": {
"campgladiator.cgui/components/atoms/input@0.0.12": {
"files": [
{
"name": "Input.js",
Expand Down Expand Up @@ -494,7 +494,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/loader@0.0.5": {
"campgladiator.cgui/components/atoms/loader@0.0.6": {
"files": [
{
"name": "Loader.js",
Expand Down Expand Up @@ -550,7 +550,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/progress-bar@0.0.8": {
"campgladiator.cgui/components/atoms/progress-bar@0.0.9": {
"files": [
{
"name": "ProgressBar.js",
Expand Down Expand Up @@ -583,7 +583,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/set-selector@0.0.5": {
"campgladiator.cgui/components/atoms/set-selector@0.0.6": {
"files": [
{
"relativePath": "src/components/atoms/SetSelector/SetSelector.js",
Expand Down Expand Up @@ -611,7 +611,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/slider@0.0.2": {
"campgladiator.cgui/components/atoms/slider@0.0.3": {
"files": [
{
"relativePath": "src/components/atoms/Slider/Slider.js",
Expand Down Expand Up @@ -644,7 +644,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/atoms/switch@0.0.4": {
"campgladiator.cgui/components/atoms/switch@0.0.5": {
"files": [
{
"name": "Switch.js",
Expand Down Expand Up @@ -672,7 +672,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/molecules/button-group@0.0.15": {
"campgladiator.cgui/components/molecules/button-group@0.0.16": {
"files": [
{
"name": "ButtonGroup.js",
Expand Down Expand Up @@ -700,7 +700,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/molecules/flash-message@0.0.3": {
"campgladiator.cgui/components/molecules/flash-message@0.0.4": {
"files": [
{
"relativePath": "src/components/molecules/FlashMessage/FlashMessage.js",
Expand Down Expand Up @@ -733,7 +733,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/molecules/modal@0.0.2": {
"campgladiator.cgui/components/molecules/modal@0.0.3": {
"files": [
{
"relativePath": "src/components/molecules/Modal/Modal.js",
Expand Down Expand Up @@ -766,7 +766,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/molecules/pin-input@0.0.2": {
"campgladiator.cgui/components/molecules/pin-input@0.0.3": {
"files": [
{
"relativePath": "src/components/molecules/PinInput/PinInput.js",
Expand Down Expand Up @@ -799,7 +799,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/molecules/radio-group@0.0.10": {
"campgladiator.cgui/components/molecules/radio-group@0.0.11": {
"files": [
{
"name": "RadioGroup.js",
Expand Down Expand Up @@ -827,7 +827,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/molecules/set-selector-group@0.0.5": {
"campgladiator.cgui/components/molecules/set-selector-group@0.0.6": {
"files": [
{
"relativePath": "src/components/molecules/SetSelectorGroup/SetSelectorGroup.js",
Expand Down Expand Up @@ -860,7 +860,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/molecules/steps@0.0.4": {
"campgladiator.cgui/components/molecules/steps@0.0.5": {
"files": [
{
"name": "Steps.js",
Expand Down Expand Up @@ -893,7 +893,7 @@
"origin": "AUTHORED",
"exported": true
},
"campgladiator.cgui/components/molecules/tooltip@0.0.1": {
"campgladiator.cgui/components/molecules/tooltip@0.0.2": {
"files": [
{
"relativePath": "src/components/molecules/Tooltip/Tooltip.js",
Expand Down
29 changes: 29 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import ButtonGroup from './components/molecules/ButtonGroup'
import Steps from './components/molecules/Steps'
import Atoms from './examples/atoms'
import Molecules from './examples/molecules'
import ProductImage from './components/atoms/ProductImage'

const toggleGrowl = () =>
document.getElementById('growlInfo') &&
Expand Down Expand Up @@ -341,6 +342,34 @@ function App() {
style={{ margin: '20px' }}
/>
</Card>

<Card style={{ padding: '20px' }}>
<ProductImage size="59px" type="bold" />
<ProductImage size="59px" type="single" />
<ProductImage size="59px" type="owf" />
<ProductImage
size="59px"
src="https://en.gravatar.com/userimage/32884912/b318719acf13489f60cba203b71e4d15.png?size=200"
/>
<ProductImage size="59px" />
<br />
<ProductImage type="bold" />
<ProductImage type="single" />
<ProductImage type="owf" />
<ProductImage src="https://en.gravatar.com/userimage/32884912/b318719acf13489f60cba203b71e4d15.png?size=200" />
<ProductImage />
<br />
<ProductImage size="123px" type="bold" style={{ margin: '2px' }} />
<ProductImage size="123px" type="single" style={{ margin: '2px' }} />
<ProductImage size="123px" type="owf" style={{ margin: '2px' }} />
<ProductImage
size="123px"
src="https://en.gravatar.com/userimage/32884912/b318719acf13489f60cba203b71e4d15.png?size=200"
style={{ margin: '2px' }}
/>
<ProductImage size="123px" style={{ margin: '2px' }} />
</Card>

<Card style={{ padding: '20px', display: 'flex' }}>
<Badge />
<Badge bold />
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Avatar/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Avatar.defaultProps = {
alt: 'user image',
size: '48px',
className: '',
style: '',
style: {},
}

Avatar.propTypes = {
Expand Down
48 changes: 48 additions & 0 deletions src/components/atoms/ProductImage/ProductImage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React, { memo } from 'react'
import PropTypes from 'prop-types'
import './ProductImage.scss'

const cdnBaseUrl =
'https://cgcdn.s3.amazonaws.com/global-ui/images/Elements/Image'

const defaultImages = {
bold: `${cdnBaseUrl}/Bold.png`,
single: `${cdnBaseUrl}/Single+Camp.png`,
owf: `${cdnBaseUrl}/One+Week+Free.png`,
default: `${cdnBaseUrl}/Image+Not+Available.png`,
}

const ProductImage = memo(
({ src, type, alt, size, className, style, ...props }) => {
const imageSource = () =>
src ? src : type ? defaultImages[type] : defaultImages.default

return (
<img
src={imageSource()}
alt={alt}
className={`cg-product-image ${className}`}
style={{ width: size, height: size, ...style }}
{...props}
/>
)
},
)

ProductImage.defaultProps = {
type: 'default',
size: '80px',
alt: 'product image',
className: '',
style: {},
}

ProductImage.propTypes = {
custom: PropTypes.string,
type: PropTypes.oneOf(['bold', 'single', 'owf', 'default']),
alt: PropTypes.string,
style: PropTypes.object,
className: PropTypes.string,
}

export default ProductImage
13 changes: 13 additions & 0 deletions src/components/atoms/ProductImage/ProductImage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Product Images are used primarily to serve the image shown at checkout for a specific product or service. This can show one of our default images (bold, single camp, one week free) or can show a custom image provided via the `src` prop.

To use a default image, use the `type` prop by passing it a string of one of the following options:

- `bold`: BOLD membership product
- `single`: single camp membership product
- `owf`: One week free product

If no image is selected via the type or src props, the default "No image available" image will be used.

Additionally, you can define the size of the image using the `size` prop. Default size is set to 80px X 80px.

Product images should always have a 1:1 ratio and should ideally be served via our CDN rather than directly from the application source code/server.
6 changes: 6 additions & 0 deletions src/components/atoms/ProductImage/ProductImage.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import '../../../assets/styles/variables.scss';

.cg-product-image {
border: 2px solid $lighter-gray;
border-radius: 5px;
}
Loading