2b5f115d41
* Remove atom icon * Swap icon usage to WordPress package * remove unused icons from library * Use @wordpress/primitives * Product cats block to listView * On-sale to use percent instead of tag icon * add to cart button use button icon * on sale products block icon * Handpicked products use stack icon * Products by stock box icon * Make sparkles woo purple * Fix icon name * Correct more tag name * fix path to icons * Update snaps * Update readme to explain updated usage * Import SVG and path from primitives * Missing isFeaturePluginBuild * Update assets/js/icons/README.md Co-authored-by: Raluca Stan <raluca.stan@automattic.com> * Update assets/js/icons/README.md Co-authored-by: Raluca Stan <raluca.stan@automattic.com> * Update assets/js/icons/README.md Co-authored-by: Raluca Stan <raluca.stan@automattic.com> * update lock Co-authored-by: Raluca Stan <raluca.stan@automattic.com> |
||
---|---|---|
.. | ||
library | ||
stories | ||
README.md | ||
index.js | ||
tsconfig.json |
README.md
Icons
WooCommerce Blocks Icons Library.
Usage
Note we use the Icon
component from @wordpress/icons
. We use some SVG icons from @woocommerce/icons
for WC Blocks specific icons, but we also use existing icons from @wordpress/icons
.
import { woo } from '@woocommerce/icons';
import { Icon, postComments } from '@wordpress/icons';
<Icon icon={ woo } /> // icon from '@woocommerce/icons'
<Icon icon={ postComments } /> // icon from '@wordpress/icons'
<Icon icon={ woo } size={ 16 } />
<Icon icon={ woo } width={ 20 } height={ Math.floor( 20 * 1.67 ) } />
Adding Icons
Before adding a new icon, make sure the icon is not already included in the Library that comes with @wordpress/icons package. If there is no existing icon suitable:
- Add the icon file to
./library
folder. - Make sure to use
SVG
primitive from@wordpress/primitives
and not a native svg.SVG
offers more accessibility features. - Remove width and height since they're handled by Icon.
- Remove any hardcoded colors on the svg. If necessary, use
CurrentColor
. - Export the Icon in
./library/index.js
.