Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified

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 set up correctly.

Usage

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.