Commit Graph

92 Commits

Author SHA1 Message Date
Darren Ethier 72f0ed470f Refactor: Introduce `wc-block-settings` bundle serving as `@woocommerce/settings` external. (https://github.com/woocommerce/woocommerce-blocks/pull/903)
* export new @woocommerce/settings external on `wc.blockSettings` global

- This handles reading data from the dom and assigning it to the global used in all packages dependent on `@woocommerce/settings` which is registered as an external pointing to the global.
- ensures that server data is only loaded on a route if needed.

* switch all direct imports of constants to use new `@woocommerce/settings` external

* enqueu new `wc-block-settings` script and attach inline data to it.

* fix test configuration and adjust test to use new external

* fix bad merge resolution after rebase

* switch constants import to `@woocommerce/settings` external after rebase

* reorder imports for convention

* improve method name
2019-08-22 16:56:47 -04:00
Darren Ethier 0b9559e2db Install @babel/plugin-proposal-class-properties. (https://github.com/woocommerce/woocommerce-blocks/pull/856)
* add @babel/plugin-proposal-class-properties plugin

* refactor ProductByCategoryBlock to use class properties
2019-08-21 09:05:17 -04:00
Mike Jolley 3a9c5ba1cd Reviews by category block (https://github.com/woocommerce/woocommerce-blocks/pull/804)
* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (https://github.com/woocommerce/woocommerce-blocks/pull/671)

* Add label to Reviews by Product controls count (https://github.com/woocommerce/woocommerce-blocks/pull/677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (https://github.com/woocommerce/woocommerce-blocks/pull/688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (https://github.com/woocommerce/woocommerce-blocks/pull/693)

* Create Reviews by Product block placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (https://github.com/woocommerce/woocommerce-blocks/pull/696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (https://github.com/woocommerce/woocommerce-blocks/pull/702)

* Lint errors

* Replace stringify query with addQueryArgs (https://github.com/woocommerce/woocommerce-blocks/pull/707)

* Add reviews endpoint (https://github.com/woocommerce/woocommerce-blocks/pull/705)

* Prevent state updates on unmounted components (https://github.com/woocommerce/woocommerce-blocks/pull/715)

* Add Order by and Load more controls in Reviews by Product frontend (https://github.com/woocommerce/woocommerce-blocks/pull/716)

* Export IconReviewsByProduct (https://github.com/woocommerce/woocommerce-blocks/pull/721)

* Fix Reviews by Product layout in IE11 (https://github.com/woocommerce/woocommerce-blocks/pull/723)

* Set minimum to per page input field (https://github.com/woocommerce/woocommerce-blocks/pull/731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (https://github.com/woocommerce/woocommerce-blocks/pull/730)

* Blocks API - Reviews endpoint with rating sort and category filtering (https://github.com/woocommerce/woocommerce-blocks/pull/726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (https://github.com/woocommerce/woocommerce-blocks/pull/732)

* Add placeholder animation (https://github.com/woocommerce/woocommerce-blocks/pull/733)

* Hook up Reviews by Product 'Order by' with endpoint (https://github.com/woocommerce/woocommerce-blocks/pull/736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (https://github.com/woocommerce/woocommerce-blocks/pull/740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (https://github.com/woocommerce/woocommerce-blocks/pull/773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (https://github.com/woocommerce/woocommerce-blocks/pull/774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (https://github.com/woocommerce/woocommerce-blocks/pull/788)

* Inital block setup

* Fix import of WithComponentID

* Render the category reviews

* Add new settings to Reviews by Product block (https://github.com/woocommerce/woocommerce-blocks/pull/787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (https://github.com/woocommerce/woocommerce-blocks/pull/811)

* Reviews by product: Update review styling and content (https://github.com/woocommerce/woocommerce-blocks/pull/806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (https://github.com/woocommerce/woocommerce-blocks/pull/820)

* Fix Reviews by Product order by select not honoring default setting (https://github.com/woocommerce/woocommerce-blocks/pull/818)

* Read more component - change how clamped content is shown (https://github.com/woocommerce/woocommerce-blocks/pull/821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (https://github.com/woocommerce/woocommerce-blocks/pull/826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (https://github.com/woocommerce/woocommerce-blocks/pull/828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (https://github.com/woocommerce/woocommerce-blocks/pull/830)

* Update based on product reviews

* Cleanup after master merge

* Implement content hiding and placeholder states for reviews blocks

* Output product names and adjust css

* Review permalink

* Remove old read-more component which was moved

* showProductName is already part of passed attributes

* CSS tweaks for missing elements

* Move dir

* Move product reviews block

* Move shared uitils

* update paths

* frontend paths

* Update paths

* shared attributes

* switch to constants

* Shared review block code

* Replace constants

* Fix hidden content bug

* star alignment
2019-08-19 15:13:07 +01:00
Albert Juhé Lluveras ad38f9d327 Create Reviews by Product block (https://github.com/woocommerce/woocommerce-blocks/pull/658)
* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (https://github.com/woocommerce/woocommerce-blocks/pull/671)

* Add label to Reviews by Product controls count (https://github.com/woocommerce/woocommerce-blocks/pull/677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (https://github.com/woocommerce/woocommerce-blocks/pull/688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (https://github.com/woocommerce/woocommerce-blocks/pull/693)

* Create Reviews by Product block placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (https://github.com/woocommerce/woocommerce-blocks/pull/696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (https://github.com/woocommerce/woocommerce-blocks/pull/702)

* Lint errors

* Replace stringify query with addQueryArgs (https://github.com/woocommerce/woocommerce-blocks/pull/707)

* Add reviews endpoint (https://github.com/woocommerce/woocommerce-blocks/pull/705)

* Prevent state updates on unmounted components (https://github.com/woocommerce/woocommerce-blocks/pull/715)

* Add Order by and Load more controls in Reviews by Product frontend (https://github.com/woocommerce/woocommerce-blocks/pull/716)

* Export IconReviewsByProduct (https://github.com/woocommerce/woocommerce-blocks/pull/721)

* Fix Reviews by Product layout in IE11 (https://github.com/woocommerce/woocommerce-blocks/pull/723)

* Set minimum to per page input field (https://github.com/woocommerce/woocommerce-blocks/pull/731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (https://github.com/woocommerce/woocommerce-blocks/pull/730)

* Blocks API - Reviews endpoint with rating sort and category filtering (https://github.com/woocommerce/woocommerce-blocks/pull/726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (https://github.com/woocommerce/woocommerce-blocks/pull/732)

* Add placeholder animation (https://github.com/woocommerce/woocommerce-blocks/pull/733)

* Hook up Reviews by Product 'Order by' with endpoint (https://github.com/woocommerce/woocommerce-blocks/pull/736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (https://github.com/woocommerce/woocommerce-blocks/pull/740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (https://github.com/woocommerce/woocommerce-blocks/pull/773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (https://github.com/woocommerce/woocommerce-blocks/pull/774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (https://github.com/woocommerce/woocommerce-blocks/pull/788)

* Fix import of WithComponentID

* Add new settings to Reviews by Product block (https://github.com/woocommerce/woocommerce-blocks/pull/787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (https://github.com/woocommerce/woocommerce-blocks/pull/811)

* Reviews by product: Update review styling and content (https://github.com/woocommerce/woocommerce-blocks/pull/806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (https://github.com/woocommerce/woocommerce-blocks/pull/820)

* Fix Reviews by Product order by select not honoring default setting (https://github.com/woocommerce/woocommerce-blocks/pull/818)

* Read more component - change how clamped content is shown (https://github.com/woocommerce/woocommerce-blocks/pull/821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (https://github.com/woocommerce/woocommerce-blocks/pull/826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (https://github.com/woocommerce/woocommerce-blocks/pull/828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (https://github.com/woocommerce/woocommerce-blocks/pull/830)

* Fix bundlesize config not picking frontend files (https://github.com/woocommerce/woocommerce-blocks/pull/840)

* Reviews by Product: split 'block.js' into smaller chunks (https://github.com/woocommerce/woocommerce-blocks/pull/841)

* Split 'block.js' into smaller chunks

* Move frontend blocks to their specific folder

* Order imports

* Typo

* Add frontend components proptypes

* Fix indentation

* Call 'this.getDefaultArgs' directly inside 'getReviews'

* Move access to wc_product_block_data to the top of the file

* Rename 'frontend' folder to 'base'

* Rename base components and move styles to their folder

* Fix Reviews by Product using rating count instead of review count (https://github.com/woocommerce/woocommerce-blocks/pull/860)

* Improve Reviews by Product accessibility (https://github.com/woocommerce/woocommerce-blocks/pull/861)

* Improve Reviews by Product accessibility

* Make 'onClick' prop not required in <LoadMoreButton>

* Wrap Reviews by Product editor block with <Disabled>

* Reviews: fix reviews without rating not appearing when sorting by rating (https://github.com/woocommerce/woocommerce-blocks/pull/863)
2019-08-15 16:55:57 +02:00
Mike Jolley 5f5797dc3d Add global data helpers (https://github.com/woocommerce/woocommerce-blocks/pull/848)
* Extract global settings to assets/js/data

* add alias

* Fix alias

* Rename to settings
2019-08-13 15:43:48 +01:00
Darren Ethier 69890535c9 Add babel-plugin-transform-remove-prop-types Babel plugin (https://github.com/woocommerce/woocommerce-blocks/pull/839)
* install transform-react-remove-prop-types babel plugin

* use `@wordpress/babel-preset-default` not `@wordpress/default` (name change)

* add configuration for new plugin (removing prop-types on production builds)
2019-08-13 09:51:44 -04:00
Mike Jolley 6a6d280eb0 Add product search block (https://github.com/woocommerce/woocommerce-blocks/pull/697)
* basic scaffold

* Progress

* Fix saving

* Move data to form

* Update assets/js/blocks/product-search/editor.scss

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/product-search/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* hex case

* Use a span element

* Move render method

* CSS

* Update buttons

* Fix navigation buttons

* remove webkit appearance styles for buttons

* Swap rich to plain text component

* Improved attribute handling

* Update assets/js/blocks/product-search/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
2019-08-05 11:25:57 +01:00
Mike Jolley d230a6a876 Update webpack config to fix ie11 2019-07-31 14:59:38 +01:00
Mike Jolley 5789a74409 Reduce number of dependencies for the product categories list block (https://github.com/woocommerce/woocommerce-blocks/pull/771)
* unqiueID helper to replace compose

* move get categories function to own file

* fix svg styling

* remove lodash dependency

* Refactor block/edit to use less dependencies

* Babel config to skip wp.element

* update comments

* Update assets/js/blocks/product-categories/frontend.js

ie11 compatible for each on nodelist

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* move id generation to constructor

* simplify webpack config

* Remove components CSS dependency

* use HOC for component ID

* Correct case on ComponentId
2019-07-29 13:00:26 +01:00
Albert Juhé Lluveras 0c0fc8be3b Remove vendors.js as a frontend dependency (https://github.com/woocommerce/woocommerce-blocks/pull/750)
* Load frontend scripts only when required

* Typo

* Use register_script from Assets

* Remove vendors as a frontend dependency

* Simplify webpack config
2019-07-22 13:10:25 +02:00
Mike Jolley c7b608a3d0 Introduce a new Products by Tag(s) block (https://github.com/woocommerce/woocommerce-blocks/pull/554)
* Introduced WGPB_Extend_Core class to modify shortcodes and API requests of core

* Require the new class

* WC_REST_Blocks_Products_Controller_V2 to override the wc-blocks API to support new tags properties

* Register new products by tag block type

* Modify utils to support tags and tag_operators

* Add ProductTagControl to handle tag searching

* Add the actual products by tag block

* Set limitTags to 100

* Create Package class and use in main plugin file

* Move and refactor library class - split asset methods into new Assets class.

* Add jetpack autoloader dependency

* fix tests

* Update from master

* AbstractBlock class for general block registration

* remove test autoloader so tests do not break

* Create AbstractProductGrid

* FeaturedProduct

* HandpickedProducts

* ProductBestSellers

* ProductCategory

* ProductNew

* ProductOnSale

* ProductTopRated

* ProductsByAttribute

* Remove old base and render functions

* Allow non-dynamic blocks and register category block

* Fix products-by-attribute due to wrong naming

* Remove no dev

* test phpunit dir

* Update testing framework

* Update with new abstract classes and build in API

* Undo edit to attribute block

* Move edit mode

* No need to support shortcodes

* correct linting errors

* Update tests/bootstrap.php

Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>

* Update code comment to make more sense.

* Correct test package

* docblock

* Fix cancel button class

* Fix classname schema

* Set loading state so spinner is shown

* Add placeholder element when no tags are selected

* No tags placeholder

* Update rest endpoints
2019-07-09 14:42:22 +01:00
Mike Jolley b528868ea1 Featured Category Block (https://github.com/woocommerce/woocommerce-blocks/pull/676)
* Block JS

* Add block to library and configure build

* Update API to return image and link

* Limit category selection to 1

* Frontend

* Fix variable

* Add icon

* Rename to isSingle

* Standardize naming

* fix wrapping issue
2019-07-09 12:38:44 +01:00
Mike Jolley 55f9951d2e Abstract block refactor (https://github.com/woocommerce/woocommerce-blocks/pull/656)
* Create Package class and use in main plugin file

* Move and refactor library class - split asset methods into new Assets class.

* Add jetpack autoloader dependency

* fix tests

* Update from master

* AbstractBlock class for general block registration

* remove test autoloader so tests do not break

* Create AbstractProductGrid

* FeaturedProduct

* HandpickedProducts

* ProductBestSellers

* ProductCategory

* ProductNew

* ProductOnSale

* ProductTopRated

* ProductsByAttribute

* Remove old base and render functions

* Allow non-dynamic blocks and register category block

* Fix products-by-attribute due to wrong naming

* Remove no dev

* test phpunit dir

* Update testing framework

* Update package name

* Classname changes from master

* get_schema_string/classname from master

* Update tests/bootstrap.php

Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>

* Update src/BlockTypes/AbstractProductGrid.php

Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
2019-07-01 15:26:06 +01:00
Kelly Dwan 27345f93a2 Add/block product categories (https://github.com/woocommerce/woocommerce-blocks/pull/613)
* Add initial work for Product Categories List block

* Add empty category toggle

* Add option to show list as a dropdown

* Fix console warnings

* Only show proptypes linter warning if the component declares proptypes

* Add frontend script to render the product categories

* Split wcSettings & wc_product_block_data globals so that the later can be used from the frontend

* Remove wp dependencies, these are added by the webpack script now

* Capture all "woo packages" into a separate script chunk

These require `wcSettings`, which can't be available on the frontend - but we do need vendors on the frontend.

* Rewrite component into a function

* Fix validation error on editor reload
2019-06-17 10:23:59 -04:00
Kelly Dwan ed36d76ff9 Try dependency plugin (https://github.com/woocommerce/woocommerce-blocks/pull/626) 2019-06-12 11:50:57 -04:00
Kelly Dwan 75ec6a48c2 Remove the styles build target in webpack (https://github.com/woocommerce/woocommerce-blocks/pull/610)
The CSS can be imported into the “global” JS file now
2019-06-10 12:47:14 -04:00
renovate[bot] 1f37bccda8 Update dependency clean-webpack-plugin to v3 (https://github.com/woocommerce/woocommerce-blocks/pull/611)
* Update dependency clean-webpack-plugin to v3

* Update CleanWebpackPlugin import for v3+
2019-05-30 10:17:00 -04:00
Mike Jolley 1fb893e3f4 Add Woo icon and branding to block categories (https://github.com/woocommerce/woocommerce-blocks/pull/581)
* remove php insertion of block category

* Add an SVG icon for the woo logo

* Add block-category.js to import into blocks

This creates the category icon complete with a Woo SVG icon

* Import block-category to all blocks that use it

* Style woocommerce blocks in woo purple

* Lint error

* fillRule case

* Update propTypes

* Use foreground prop instead of css

* Convert Woo Logo to ICON type component

* Add shared blocks.js to house the category code

* Calculate width from height
2019-05-28 11:18:07 +01:00
Kelly Dwan 099835918b Set the vendors chunk to always split out shared node_modules code (https://github.com/woocommerce/woocommerce-blocks/pull/577) 2019-05-21 11:29:09 +01:00
Mike Jolley e8f3d3776f Show build progress (https://github.com/woocommerce/woocommerce-blocks/pull/557)
* Add progress indicator to build

* Clean up post-build output (only show build files)

* Enable cacheDirectory

* Supress start output
2019-05-13 13:08:32 +01:00
Kelly Dwan 3920836287 Update ProductsControl to use API search when product catalog is large (https://github.com/woocommerce/woocommerce-blocks/pull/515)
* Move query path into constant

* Add catalog size as a preloaded setting

* Pass a search callback to SearchListControl

This will limit the number of products loaded, and update the product list via an API call, when there are over 200 products

* Extract the API requests into a separate file

* Fix proptype warning

* Only trigger the selected request if there are selected products

* Add new `@wordpress/*` dependencies from wc package bumps

* Move the "large catalog" check to the server side

* Update to components@2.0.0
2019-04-12 11:47:29 -04:00
Kelly Dwan d826ee9ee9 Add a custom jsonpFunction to prevent collisions with other splitChunks-using projects (https://github.com/woocommerce/woocommerce-blocks/pull/520) 2019-04-08 17:53:06 -04:00
renovate[bot] 8f998a4859 chore(deps): update dependency clean-webpack-plugin to v2 (https://github.com/woocommerce/woocommerce-blocks/pull/466)
* chore(deps): update dependency clean-webpack-plugin to v2

* Update options for v2.0
2019-03-04 09:48:27 -08:00
Kevin Killingsworth 1288fe1c75 Remove legacy block (https://github.com/woocommerce/woocommerce-blocks/pull/457)
* Remove legacy block

This removes the legacy products block and sets the version to
v2.0.0-dev

* Remove legacy product block test

* Update plugin header version
2019-02-26 14:16:21 -06:00
Kelly Dwan 17ff1aa886 Blocks: Add new content controls to grid blocks (https://github.com/woocommerce/woocommerce-blocks/pull/440)
* Component: GridContentControl for controlling visibility of product content

* Add the content control to all grid blocks

* Use CSS to hide the content on the front end

* Fix missing translation functions
2019-02-21 14:00:47 -05:00
Kelly Dwan b14a37f7b5 Update CSS build process (https://github.com/woocommerce/woocommerce-blocks/pull/439)
* Split apart editor and frontend styles

* Remove the empty JS files after each build

* Pull out editor and style CSS files into two single, separate files
Rename products-grid CSS, add a “global” front end stylesheet

* Update style registration to use these two new global CSS files

* Merge style JS files into vendors before deleting them

* Remove empty file to fix lint error

* Check for file before reading from it

When watching, not all the file stubs are created, so this errors out.
2019-02-19 16:09:36 -05:00
Kelly Dwan ac96484f7a New block: Products by Attribute (https://github.com/woocommerce/woocommerce-blocks/pull/378)
* Add Products by Attribute block

* Remove attributes property from sharedAttributes

* Add operator control to Products Attribute selector

* Fix default operator queries

* Add the initial “edit mode” placeholder screen

* Style attribute selector better

* Add ‘edit mode’ toggle to toolbar

* Add orderby control
2019-01-30 16:27:56 -05:00
Kelly Dwan 71b448f8b6 Build: Split out vendor files into separate, shared JS & CSS files (https://github.com/woocommerce/woocommerce-blocks/pull/314)
* Add splitchunks to webpack config to combine node_modules imports into a vendors script

* Move legacy CSS into legacy folder

* Get components css without needing to use relative path

* Add vendors css file
2019-01-14 15:33:17 -05:00
Kelly Dwan 64e46b8f8e Add ProductControl, update SearchListControl to pick a "single item" (https://github.com/woocommerce/woocommerce-blocks/pull/304)
* Add a prop to turn on “single choice” mode

* Create new ProductControl to select a single product

* Remove align from shared attributes

This is given to us by default for using supports.align

* Add Featured Product block

* Fix spelling mistake & copy-paste issue

* Fix lint warning

* Add featured product script to build process, register block in PHP
2019-01-10 14:01:49 -05:00
Kelly Dwan 6a1c1490cb Split blocks into separate JS files (https://github.com/woocommerce/woocommerce-blocks/pull/305)
This lets us use the functionality of `register_block_type` to automatically enqueue the scripts and styles used by blocks in the editor, and eventually, styles on the frontend as well. Also adds cssnano to minify our CSS.
2019-01-10 13:16:37 -05:00
Kelly Dwan 43675515af Block: Add new "Best Selling Products" block (https://github.com/woocommerce/woocommerce-blocks/pull/221)
* Move from a JS file per block registration to one file registering all blocks

This will let webpack combine shared libraries, like gridicons

* Move global block settings to the “before all scripts” section

These shouldn’t be tied to a specific block file, since they’re used across all blocks

* Register both block types

We can also remove the scripts, since we enqueue these below

* Update getShortcode & getQuery to handle different block types

* Pass block type name to getQuery

* Update shared attributes - edit_mode is not a universal option, but categories will be

Categories is shared, but orderby is not

* Add “Best Selling Products” block

* Add a shared class name for product grid blocks

* Fix failing tests
2018-12-13 12:19:55 -05:00
Kelly Dwan 4ac52b3cf3 Create a reusable search + list control for category selection (https://github.com/woocommerce/woocommerce-blocks/pull/166)
* Add new components for ProductCategoryControl, using a reusable SearchListControl

* Add sass variables from wc-admin

* Finish styling

* Save selected categories as selected for the block

* Style sidebar version of control

* Filter the categories list, highlight search term in result

* Filter out selected items in the filter list function

* Add spacing in the placeholder, remove unnecessary stylesheet

* Add a more descriptive label for screen readers

* Remove category references from list item options

* Switch to a configurable object of messages, so SearchListControl can be more customizable

* Add screen-reader message for toggling “done” and moving into preview

* Remove call to getProductCategoryControl

The component is simple enough to just drop in now :)

* Add documentation for all props

* Add padding to placeholder

* Rename fallbackrenderItem to defaultRenderItem

* Add a variable to save the selected count

* Add `isDestructive` to make link red

* Update item style

* Add a hover/focus background color
2018-11-29 13:10:08 -05:00
Kelly Dwan eb21a5ec9f Update dependencies, add all packages in use (https://github.com/woocommerce/woocommerce-blocks/pull/159) 2018-11-27 12:13:16 -05:00
Kelly Dwan c98e607a6f Add the "edit mode" toggle to the product category block (https://github.com/woocommerce/woocommerce-blocks/pull/144)
* Add sass mixins and variables

* Add an edit mode toggle, with the ability to choose categories

* Only add align classes when align is defined
2018-11-21 11:33:21 -05:00
Kelly Dwan 2231c829d1 Add a basic product category block (https://github.com/woocommerce/woocommerce-blocks/pull/136)
* Add a second block, for “products by category”

* Fetch products in the given category, when attributes change

* Display the resulting products

* Style the product preview

* Create utils folder, move shared attributes

* Move getQuery to shared utils folder

* Create a helper function to get the shortcode string

* Support the menu_order setting

* Support center/wide/full alignment

* Update PropTypes

* Add tests

* Add text domain to translation functions
2018-11-19 11:33:17 -05:00
Kelly Dwan b52bb64d88 Move legacy block to “legacy” folder (https://github.com/woocommerce/woocommerce-blocks/pull/135) 2018-11-19 11:31:43 -05:00
Kelly Dwan 9090fb41a1 Add .editorconfig file for editor integration (https://github.com/woocommerce/woocommerce-blocks/pull/128) 2018-11-16 10:42:56 -05:00
Kelly Dwan 45f519590e Add eslint to find and fix code style issues (https://github.com/woocommerce/woocommerce-blocks/pull/123)
* Add eslint configuration

* Run eslint auto-fixer to cover fixable issues

* Use wp.element’s component to prevent undefined React error

* Add products data global to eslint config

* Fix remaining eslint errors by hand

* Fix eslint errors in webpack

* Remove duplicate rule
2018-11-13 14:21:04 -05:00
Kelly Dwan 140f4e5ed6 Update build process (https://github.com/woocommerce/woocommerce-blocks/pull/122)
* Add api-fetch dependency

* Remove compiled files from the repo

* Update build process, remove grunt

* Import CSS into block, as we now extract CSS via webpack to build

* Update enqueue scripts to reflect new build locations

* Detect if build files don’t exist, and instruct users to build project

* Update readme with build instructions

* Clarify where to run npm commands in info notice

* Only enqueue our JS files if we know they exist

* Clarify version compatibility between WC and WP 5.0
2018-11-13 14:12:32 -05:00
claudiulodro 9949564a42 Products search and select 2018-02-16 11:40:19 -08:00
claudiulodro d94773bd6f Modularize the settings screens 2018-02-15 10:16:14 -08:00
claudiulodro 6533d2f166 Set up and move things over for a feature plugin 2018-02-13 11:03:53 -08:00