File size: 3,802 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# ProductIcon Component

ProductIcon component is a React component to display plan or product icon in SVG format.

Please note that this component uses asset imports for generating icon images URLs.
Most build environments handle the asset imports gracefully out of the box (e.g. `create-react-app`, `calypso-build`).
If you're using a custom Webpack environment, make sure that you have the [asset imports](https://webpack.js.org/guides/asset-management/#loading-images) set up correctly.

## Usage

```jsx
import { ProductIcon } from '@automattic/components';

export default function MyComponent() {
	return (
		<div className="my-component">
			<ProductIcon slug="plan_free" />
			<ProductIcon slug="jetpack_business" />
			<ProductIcon slug="jetpack_backup_daily_monthly" />
		</div>
	);
}
```

## Props

### `slug`

Plan or product slug. Can be one of the following:

- `free_plan`
- `blogger-bundle`
- `blogger-bundle-2y`
- `personal-bundle`
- `personal-bundle-2y`
- `personal-bundle-monthly`
- `value_bundle`
- `value_bundle-2y`
- `value_bundle-monthly`
- `ecommerce-bundle`
- `ecommerce-bundle-2y`
- `ecommerce-bundle-monthly`
- `business-bundle`
- `business-bundle-2y`
- `business-bundle-monthly`
- `pro-plan`
- `starter-plan`
- `jetpack_free`
- `jetpack_personal`
- `jetpack_personal_monthly`
- `jetpack_premium`
- `jetpack_premium_monthly`
- `jetpack_business`
- `jetpack_business_monthly`
- `jetpack_complete`
- `jetpack_complete_monthly`
- `jetpack_complete_v2`
- `jetpack_complete_monthly_v2`
- `jetpack_crm`
- `jetpack_crm_monthly`
- `jetpack_backup_daily`
- `jetpack_backup_daily_monthly`
- `jetpack_backup_realtime`
- `jetpack_backup_realtime_monthly`
- `jetpack_backup_v2`
- `jetpack_backup_daily_v2`
- `jetpack_backup_daily_monthly_v2`
- `jetpack_backup_realtime_v2`
- `jetpack_backup_realtime_monthly_v2`
- `jetpack_backup_t1_yearly`
- `jetpack_backup_t1_monthly`
- `jetpack_backup_t2_yearly`
- `jetpack_backup_t2_monthly`
- `jetpack_boost`
- `jetpack_boost_monthly`
- `jetpack_growth`
- `jetpack_scan`
- `jetpack_scan_monthly`
- `jetpack_scan_v2`
- `jetpack_scan_monthly_v2`
- `jetpack_scan_daily_v2`
- `jetpack_scan_daily_monthly_v2`
- `jetpack_scan_realtime_v2`
- `jetpack_scan_realtime_monthly_v2`
- `jetpack_search`
- `jetpack_search_monthly`
- `jetpack_social`
- `jetpack_social_monthly`
- `wpcom_search`
- `wpcom_search_monthly`
- `jetpack_search_v2`
- `jetpack_search_monthly_v2`
- `jetpack_anti_spam`
- `jetpack_anti_spam_monthly`
- `jetpack_anti_spam_v2`
- `jetpack_anti_spam_monthly_v2`
- `jetpack_security_v2`
- `jetpack_security_monthly_v2`
- `jetpack_security_daily_v2`
- `jetpack_security_daily_monthly_v2`
- `jetpack_security_realtime_v2`
- `jetpack_security_realtime_monthly_v2`
- `jetpack_security_daily`
- `jetpack_security_daily_monthly`
- `jetpack_security_realtime`
- `jetpack_security_realtime_monthly`
- `jetpack_security_t1_yearly`
- `jetpack_security_t1_monthly`
- `jetpack_security_t2_yearly`
- `jetpack_security_t2_monthly`
- `jetpack_videopress`
- `jetpack_videopress_monthly`

### `className`

Additional class name to be added to the icon element.

## How to Add New Icon

In order to add a new icon to the component, do the following:

- Add a new icon image to the `images` folder.
- Import the image in the `config.js` file. This way an image URL will be generated by a bundler for further reuse.
- Add the image path to the `paths` object in the `config.js` file.
- Add a new entry in the `iconToProductSlugMap` object in the `config.js` file:
  - key should match the image slug that just have been added,
  - value should be an array of product slugs the image should be displayed for.
- Document the new icon as an available option for the `slug` prop in this README.
- Optionally, update the `docs/example.jsx` file to include the new icon.