Commit Graph

268 Commits

Author SHA1 Message Date
Mike Jolley 7e19eefa82 Cancel styles 2019-05-21 13:58:35 +01:00
Mike Jolley e096666211 Update/dynamic grid blocks html (https://github.com/woocommerce/woocommerce-blocks/pull/567)
* Add grid block base class to handle rendering all grid blocks

Using code from the shortcode handler to create the query, subclass into newest product to show use

* Update preview content to match rendering from the new grid block handler

* Fix the categories query builder

* Update order of rating/price

* Remove center alignment

* Extract rating & button into separate functions

* Wrap the content in a link

* Add the current class names for better theme support

* Fix some styling in editor preview & frontend

* Add back the deprecated cols support for existing blocks

* Add multiple-rows class, style tweaks

* Switch Newest Products to dynamic rendering, deprecate existing shortcode method

* Add “On Sale” flag

* Switch “On Sale Products” to dynamic rendering

* Fix reusable block preview

* Add correct classes to On Sale Products

* Remove dynamic blocks from CSS hidden content rules

Content is not output to browser now, so we don’t need to hide it

* Fix undefined parameters

* Fix attributes for on sale

* Add deprecation comment, use more descriptive function name

* Addressing review feedback

* Update test: classnames have changed, image now wrapped in div

* Disable HTML editing for dynamic blocks

* Moved rendering logic into block library

* Update HTML rendering for products and remove core template functions

* Update styling

* Put the wp block class back

* Remove style import

* Move container classes to div not the ul

* Remove visibility classes

* Avoid rending non-visible items

* Revert style additons for visbility

* Fix CSS now that class names have shifted
2019-05-16 17:30:40 +01:00
Kelly Dwan a03a9d759b Try dynamic blocks for rendering content (replacing shortcode output) (https://github.com/woocommerce/woocommerce-blocks/pull/558)
* Add grid block base class to handle rendering all grid blocks

Using code from the shortcode handler to create the query, subclass into newest product to show use

* Update preview content to match rendering from the new grid block handler

* Fix the categories query builder

* Update order of rating/price

* Remove center alignment

* Extract rating & button into separate functions

* Wrap the content in a link

* Add the current class names for better theme support

* Fix some styling in editor preview & frontend

* Add back the deprecated cols support for existing blocks

* Add multiple-rows class, style tweaks

* Switch Newest Products to dynamic rendering, deprecate existing shortcode method

* Add “On Sale” flag

* Switch “On Sale Products” to dynamic rendering

* Fix reusable block preview

* Add correct classes to On Sale Products

* Remove dynamic blocks from CSS hidden content rules

Content is not output to browser now, so we don’t need to hide it

* Fix undefined parameters

* Fix attributes for on sale

* Add deprecation comment, use more descriptive function name

* Addressing review feedback

* Update test: classnames have changed, image now wrapped in div

* Disable HTML editing for dynamic blocks

* Moved rendering logic into block library

* Remove unnecessary !important on styles
2019-05-16 14:03:11 +01:00
Kelly Dwan 0e68c9b12c Update and add documentation in READMEs (https://github.com/woocommerce/woocommerce-blocks/pull/551) 2019-05-09 10:45:09 -04:00
Kelly Dwan fccb6737eb ProductControl: Update product search performance (https://github.com/woocommerce/woocommerce-blocks/pull/547)
* Move the products API utilities to a shared folder

* Use the `onSearch` callback when we have a “large catalog”
2019-05-03 10:38:13 -04:00
Kelly Dwan e8fb6e7c94 Add "FocalPointPicker" to Featured Product block (https://github.com/woocommerce/woocommerce-blocks/pull/544)
* Add FocalPointPicker to featured product block

* Disable the media icon if no product is selected

* Use the focal point on the frontend display

* Check for `FocalPointPicker` before using it (compat for WP 5.1)

* Check if focalPoint attribue is an array before trying to use it
2019-05-03 10:37:52 -04:00
Kelly Dwan 8bc7adbee4 Grid Blocks: Prevent invalid parameter passed to API (https://github.com/woocommerce/woocommerce-blocks/pull/543)
* Prevent invalid parameter passed to API

per_page cannot be greater than 100, but the frontend does support a larger limit

* Add tests
2019-04-30 16:30:43 -04:00
Kelly Dwan 7bac46f286 Move conflict check to init action (https://github.com/woocommerce/woocommerce-blocks/pull/534)
Checking the feature plugin version on `init` ensures the constant is defined before we get to it, which is not guaranteed in `__construct` due to potential different load orders.
2019-04-19 12:33:04 -04: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 23532701dd Fix fatal with 1.x versions of the feature plugin (https://github.com/woocommerce/woocommerce-blocks/pull/502)
* Add plugin version check to prevent fatal error with core + 1.4

* Version bump
2019-03-22 10:42:01 -04:00
Kelly Dwan d2f1aa6c44 Update grid blocks preview to match width of products on the frontend (https://github.com/woocommerce/woocommerce-blocks/pull/489)
* Update grid blocks preview to match width of products on the front end

* Remove max-width from CSS, set it on the preview itself so we can use the dynamic theme width

* Override block thumbnail width for multiple column layouts

Previously larger thumbnails would cause multiple column layouts to break and wrap early. This enforces the column width for those cases

* Add the thumbnail size to images, to prevent larger images in multiple col layouts

* Update snapshot to new preview markup
2019-03-15 12:48:46 -04:00
Kelly Dwan 8ea719b140 Grid blocks: Use a different theme option name for block column/row values (https://github.com/woocommerce/woocommerce-blocks/pull/481)
* Use a different theme option name for block column/row values

* Update the default columns value
2019-03-14 10:22:29 -04:00
Kelly Dwan 7dc5187b4b Check for the existence of productId before using it (https://github.com/woocommerce/woocommerce-blocks/pull/480) 2019-03-07 17:01:53 -05:00
Kevin Killingsworth 245f472a4b Category block: select categories when none selected (https://github.com/woocommerce/woocommerce-blocks/pull/458)
* Category block: open category panel when no categories

When no categories are selected, open the category panel on initial
render.

* Add check for editMode

Don't open categories if in edit mode because the block itself has a
category selection.
2019-03-06 13:51:21 -05:00
Kelly Dwan 9fa9257430 Blocks: Add rating to grid previews (https://github.com/woocommerce/woocommerce-blocks/pull/472)
* Add rating stars to the product preview

* Add rating to the visibility controls
2019-03-06 13:50:32 -05:00
Kelly Dwan 7f78a79698 Set up plugin to be published on npm (https://github.com/woocommerce/woocommerce-blocks/pull/456)
* Move block rendering class into assets

* Update package.json for npm

* Move script registration into publish-able file

* Fix phpcs issue

* Add note about source of file

* Add wcSettings back in

* Rename files to match class name

* Add languages & includes back, so we can use this for publishing zip files

* Update documentation, versions, and add hook for wc components settings

* Update wcSettings output to use fitler

* Update version to `alpha`

* Make block library class into a singleton
2019-03-04 09:30:06 -08:00
Timmy Crawford db79f75376 Update/wc blocks/v1/products (https://github.com/woocommerce/woocommerce-blocks/pull/459)
* Update products endpoint to match core.

* Update usage of cat_operator and attr_operator

* Fix phpcs issue

* Update parameter in tests
2019-02-28 10:07:38 -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
Timmy Crawford 8e3d19ee6d REST API: Update usage of attributes/<id>/terms to match core. (https://github.com/woocommerce/woocommerce-blocks/pull/453)
* REST API: Update usage of attributes/<id>/terms to match core.

* phpcs fixes, i think
2019-02-26 08:11:31 -08:00
Kevin Killingsworth 7ffc11d987 Fix html in preview of product titles (https://github.com/woocommerce/woocommerce-blocks/pull/444)
* Fix html in preview of product titles

Previously the html wasn't rendered in the preview for product titles.
This renders the html.

* Update test snapshot

* Also decode html for featured preview name.

* Un-escape HTML for featured post title render
2019-02-25 23:32:04 -06:00
Kevin Killingsworth ffc19e26ec Add transforms for shared attributes. (https://github.com/woocommerce/woocommerce-blocks/pull/448)
* Add transforms for shared attributes.

This adds transforms for the 5 blocks which share attributes:

- woocommerce/product-best-sellers
- woocommerce/product-category
- woocommerce/product-new
- woocommerce/product-on-sale
- woocommerce/product-top-rated

* Use createBlock directly and rowColumnBlockTypes

This adds rowColumnBlockTypes as an array of woocommerce/* block types
that use row and column layouts

* Move block types into utils, and use without

This uses lodash instead of without instead of difference
It also moves the block types from an index into the shared-attributes
in utils.
2019-02-25 23:31:25 -06:00
Timmy Crawford 57155e685f REST API: Change namespeace to reflect what will exist in Woo core. (https://github.com/woocommerce/woocommerce-blocks/pull/451) 2019-02-25 12:23:29 -08: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 2a00a897d5 Components: Move SearchListControl to woocommerce/components (https://github.com/woocommerce/woocommerce-blocks/pull/442)
* Switch to using the SearchListControl from woocommerce/components

* Remove unused mixin
2019-02-21 13:07:08 -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
Kevin Killingsworth ecb0f7741b Add catalog_visibility param to products api (https://github.com/woocommerce/woocommerce-blocks/pull/406)
* Add catalog_visibility param to products api

This adds a catalog_visibility=visible option to the product api which
will filter out any products that are excluded from the catalog.

* Add product_visibility phpunit test

* Add catalog_visibility for catalog, search, hidden

* Fix util js test

The util js test checks for query parameters, so this adds the
category_visibility = 'visible' param.

* Updated for comments

1. Added collection params
2. moved catalog_visibility default with others
2019-02-19 10:09:16 -06:00
Kelly Dwan a503af9e51 Add space between the icon and placeholder title (https://github.com/woocommerce/woocommerce-blocks/pull/421) 2019-02-18 09:48:34 -05:00
Kelly Dwan ee8e185e4d Featured Product: Remove ability to change source product (https://github.com/woocommerce/woocommerce-blocks/pull/415) 2019-02-12 10:04:36 -05:00
Kelly Dwan 299412bb0f Featured Product: Try using Button block for button (https://github.com/woocommerce/woocommerce-blocks/pull/398)
* Try using Button block for the product button

* Use the permalink for the selected product

* Fix use of templateLock prop

* Fix button component alignment
2019-02-08 18:57:58 -05:00
Kelly Dwan 1f880b309a ProductAttributeControl: Polish style, screen reader interaction (https://github.com/woocommerce/woocommerce-blocks/pull/412)
* Save attribute terms per attribute, so we don’t need to do duplicate API requests for previously fetched terms. Add spinner to loading items.

* Add count to API response

* Use terms count in displaying attribute type

* Update attribute selection code to collapse already-selected attributes

* Add a chevron icon indicating open-able attributes

* Center the loading indicator

* Remove count from attribute type & re-add it to the terms themselves
2019-02-08 14:57:56 -05:00
Kelly Dwan 388d083c2b Products by Attribute: Update block to use API, shortcode rendering (https://github.com/woocommerce/woocommerce-blocks/pull/405)
* Add “attribute selection” step before allowing terms to be selected

* Update query builder

* Use shortcode to render block

* Styling for child list items
2019-02-07 15:26:47 -05:00
Kelly Dwan 6bf837ff7a Featured Product: Allow to resize the block height (https://github.com/woocommerce/woocommerce-blocks/pull/397)
* Add ResizeableBox wrapper to component to adjust height

* Use the fixed height on the front end display of the block

* Fix display of resize handle

* Allow the default & min featured product heights to be customized by setting a new theme support keyword, `featured_block`.

* Use `min-height` on the front end display, so content is not clipped on smaller screens

* Add a wrapper div to the content, to prevent it from breaking out of the block display
2019-02-05 15:49:24 -05:00
Kevin Killingsworth dc2b4485f4 Add placeholder image for product preview (https://github.com/woocommerce/woocommerce-blocks/pull/382)
* Add placeholder image for product preview

This adds the designated placeholder image url from settings into the
wcSettings global for the blocks to use. Then uses the placeholder url
when a product doesn't have any images.

* Updated based on review notes

Using `$block_settings` instead of `$settings`
Using '' alt tag
Updated snapshot

* Add the placeholder global to test that it passes through to the preview
2019-02-01 10:45:53 -05:00
Kelly Dwan 017f0df5b7 Blocks: Restrict row/column values to only valid values (https://github.com/woocommerce/woocommerce-blocks/pull/386)
* Add a new LayoutControl component

* Use new LayoutControl to handle rows & columns settings

* Fix errors when rows or columns is empty (silently fall back to default to prevent breaking the block)

* Rename `LayoutControl` to `GridLayoutControl`
2019-01-31 17:55:54 -05:00
Kelly Dwan 5f4b6c74db Use defaultProps to set up the taxonomy control operators (https://github.com/woocommerce/woocommerce-blocks/pull/381) 2019-01-31 15:43:55 -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 eee1359cc0 Fix translations, bundle complete JS translation files (https://github.com/woocommerce/woocommerce-blocks/pull/339)
* Update the translation file with strings in new JS files

* Automatically build the translation files when building the JS files

* Reorganize script+style registration so that all files for each block are grouped together

* Bundle the finished translations into the plugin

* Fix untranslated strings

* Remove the edit-blocks dependency from featured product CSS file (https://github.com/woocommerce/woocommerce-blocks/pull/342)
2019-01-17 11:58:53 -05:00
Kelly Dwan 7a67ad3c26 SearchListControl: Use the “radio” role for selecting just one item (https://github.com/woocommerce/woocommerce-blocks/pull/337) 2019-01-17 10:58:41 -05:00
renovate[bot] 0dfece4fd6 Update dependency @woocommerce/components to v1.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/333)
* Update dependency @woocommerce/components to v1.4.0

* Fix test snapshots
2019-01-16 18:58:37 -05:00
Kelly Dwan ea4996267c Add catOperator to remaining blocks (https://github.com/woocommerce/woocommerce-blocks/pull/328) 2019-01-15 13:52:34 -05:00
Kelly Dwan 6267b32772 Featured Product block: Allow custom background image selecton (https://github.com/woocommerce/woocommerce-blocks/pull/322)
* Add media icon to toolbar, save selected media ID and src as attributes

* Use the selected image instead of the product image, if set

* Unset the selected image when a new product is selected
2019-01-14 17:22:00 -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 162c55d0cc Hide the legacy products block from the block inserter (https://github.com/woocommerce/woocommerce-blocks/pull/143) 2019-01-14 15:03:12 -05:00
Kelly Dwan 2201fe7db7 Remove the “Filter by Attribute” panel from products by category block (https://github.com/woocommerce/woocommerce-blocks/pull/321) 2019-01-14 14:53:55 -05:00
Kelly Dwan 6f2719d36b Featured Product Block: Use real product short description (https://github.com/woocommerce/woocommerce-blocks/pull/315) 2019-01-14 14:53:30 -05:00
James Koster 9c414cac0a Featured Products style tweaks (https://github.com/woocommerce/woocommerce-blocks/pull/316)
* Update search list item padding

* Fix search list item radio alignment

* Star icon: Material -> Dashicons

* Featured product min height

* placeholder icon + explanation of explicit height value

* Fix linter errors

* Remove unnecessary Icon from block registration

* Remove the star icon
2019-01-14 14:37:35 -05:00
Kelly Dwan 0d720183aa Add "Featured Product" block preview (https://github.com/woocommerce/woocommerce-blocks/pull/308)
* Add classnames package

* Add background image & initial styles

* Only show inspector controls when not in edit-mode

* Add overlay color + opacity controls

* Add content alignment

* Fix display of content

* Add content toggles

* Update styles from feedback

* Display the "Featured Product" block on the frontend (https://github.com/woocommerce/woocommerce-blocks/pull/310)

* Add render_callback to dynamically render product

* Set a size for the product description

* Remove fallback placeholder image

* Reset the background color for the placeholder component

Previously this was overriding storefront's custom background color CSS

* Update nested conditional

* Remove unnecessary style

* "Featured Product" Block: Add link to the product to the block (https://github.com/woocommerce/woocommerce-blocks/pull/311)

* Featured Product Block: Add link to the product to the block

* Add a better link label for screen reader users

* Match core button styles, fix alignment of button-link
2019-01-13 12:22:15 -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 86874a64e6 Icons: add star and radio button icons, organize folder (https://github.com/woocommerce/woocommerce-blocks/pull/303)
* Split out icons into individual files, add radio icons

* Add star icon

* Fix SVG output in tests
2019-01-09 15:33:10 -05:00
Kelly Dwan 79574a6450 Products by Category: don't show products if no category is selected, better message (https://github.com/woocommerce/woocommerce-blocks/pull/281)
* Prevent Products by Category from showing all products when no category is selected

* Update string when no categories are selected

* Update button text

* Revert button change, Done is more appropriate
2019-01-04 16:34:37 -05:00
Kelly Dwan bc53626f1d Hide the selected items section until the content is loaded (https://github.com/woocommerce/woocommerce-blocks/pull/282)
This will prevent the inaccurate “0 items selected” message
2019-01-03 11:16:00 -05:00
Kelly Dwan 03eaddd197 New block: add "Hand-picked Products" block (https://github.com/woocommerce/woocommerce-blocks/pull/276)
* Add ProductsControl component to search and select products

* Add “Hand-picked Products” block

* Update hand-picked & new product icons

* Prevent API request when no products are selected

* Remove rows setting

* Update shortcode/query helpers for the handpicked products

* Remove shortcode from post if no product IDs are passed

Rendering a shortcode with `ids=‘’` will show all products, as if the ids param wasn’t there. The expected outcome would be no products are shown, we we achieve by removing the shortcode.

* Remove unused rows attribute

* Update accessible spoken notice

* Add a variable to hold whether there are selected products

* Fix copy-paste comments
2018-12-21 19:10:17 -05:00
Kelly Dwan 6d06990123 Visually hide the “any”/“all” categories selector when less than 2 categories are selected (https://github.com/woocommerce/woocommerce-blocks/pull/279) 2018-12-21 12:45:07 -05:00
Kelly Dwan 32b5b07c23 Add ProductAttributeControl for selecting product attributes (https://github.com/woocommerce/woocommerce-blocks/pull/266)
* Add initial attribute selector control

* Make the attribute group name unselectable

* Update selected map to reflect attribute syntax

* Add the attributes selector to the product category block

* Update copy-paste comment

* Update variable name to be more clear

* Move & rename the attribute selector in Products by Category

* Reorganize the API calls to fetch attributes + attribute terms
2018-12-20 17:26:51 -05:00
Kelly Dwan c8775aa4e1 Fix the spacing around the “edit mode” of Products by Category (https://github.com/woocommerce/woocommerce-blocks/pull/273) 2018-12-19 17:35:41 -05:00
Kelly Dwan ba8ce223cf Use em-dashes to indent child categories/attributes instead of padding (https://github.com/woocommerce/woocommerce-blocks/pull/265) 2018-12-19 17:34:28 -05:00
Kelly Dwan 18f99101e2 Fix multiple API calls returning out of order, causing set rows to be incorrect (https://github.com/woocommerce/woocommerce-blocks/pull/264) 2018-12-19 17:18:13 -05:00
Kelly Dwan aa9f543834 Add new SearchListItem component (https://github.com/woocommerce/woocommerce-blocks/pull/258)
* Add new SearchListItem component

Extract the custom functionality from product categories, for re-use in product attributes

* Fix error when no breadcrumbs are set

* Update snapshot

* Remove unnecessary key
2018-12-19 11:56:44 -05:00
David Levin 5af019bcd7 New Block: Add "Newest Products" Block (https://github.com/woocommerce/woocommerce-blocks/pull/255)
* add newest products block

* update class name in index.js and product-new.js

* Add a new WooCommerce block category and include all blocks within.

* Fix shortcode product order

* Show block category on all post types
2018-12-18 14:45:49 -05:00
Kelly Dwan 48cd95d64d Move icon components to a shared component, add New Releases SVG (https://github.com/woocommerce/woocommerce-blocks/pull/257) 2018-12-17 15:51:10 -05:00
Kelly Dwan 3bccfda459 Category Selection: Add support for category operator (https://github.com/woocommerce/woocommerce-blocks/pull/251)
* Add core breakpoint 480px, remove non-core breakpoints

* Add the optional operator & save callback

* Add the catOperator as a valid attribute

* Enable cat operator for Products by Category

* Add cat_operator support the products API endpoint

* Enable cat_operator in the shortcode and query utils

* Pluralize the “nothing found” string if we have multiple categories

* Fix style in the inspector panel

* Add category operator support to the Best Sellers product block

* Add cat_operator support to On Sale Products block

* Update label & margin
2018-12-17 15:16:01 -05:00
Michael Rogowski fef17476c8 Fix undefined error when selecting a product without an image (https://github.com/woocommerce/woocommerce-blocks/pull/254)
prior to this commit, an 'individual product' block would produce
an error if associated with a product with no image.
2018-12-17 15:15:32 -05:00
Kelly Dwan 395888a521 Fix mix of tabs/spaces 2018-12-15 11:41:39 -05:00
David Levin 0c9e3eb6ba resolving conflicts 2018-12-14 18:12:13 -08:00
David Levin 1bf9ab1fb5 resolve conflicts 2018-12-14 18:08:58 -08:00
David Levin 3b770feb90 remove unnecessary function from get-shortcode.js 2018-12-14 17:48:46 -08:00
Kelly Dwan 381752734b New Block: Add "On Sale Products" block (https://github.com/woocommerce/woocommerce-blocks/pull/239)
* Add “On Sale Products” block

* Remove categories requirement from fetching products on mount
2018-12-14 18:47:16 -05:00
David Levin cae9799ffc update ordering by rating 2018-12-14 12:21:56 -08:00
David Levin d30761ba2f Add top rated products block 2018-12-14 11:45:19 -08:00
Kelly Dwan 58f3764c36 Move product order list into a shared component (https://github.com/woocommerce/woocommerce-blocks/pull/238) 2018-12-14 09:57:32 -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 e3dab1cbcc Product preview: Update "Add to cart" button to inherit theme's button styles (https://github.com/woocommerce/woocommerce-blocks/pull/223)
* Remove button styling & add classes to inherit style from core button

* Update to CSS grid

* Prevent warnings when running autoprefixer

* Update spacing in preview

* Update snapshots to reflect button markup change

* Switch to flexbox for IE 11 support

* Remove CSS grid autoprefixer support

* Fix spacing on preview items

* Fix stylelint issue

* Remove unnecessary rule
2018-12-13 12:19:06 -05:00
Joshua T Flowers fed2de790c Add key prop to dropdown elements (https://github.com/woocommerce/woocommerce-blocks/pull/229) 2018-12-11 17:29:15 -05:00
Kelly Dwan a92ae1477b Remove “center” alignment option (https://github.com/woocommerce/woocommerce-blocks/pull/214) 2018-12-05 12:00:40 -05:00
Kelly Dwan 02f8aa1091 Add styles for better reusable block preview (https://github.com/woocommerce/woocommerce-blocks/pull/210)
* Add styles for better reusable block preview

* Fix class names for legacy block preview style

* Check that `products` exists before checking length

* Fix stylelint issues
2018-12-04 15:40:00 -05:00
Kelly Dwan 723c8eedab Update textdomain to plugin slug (https://github.com/woocommerce/woocommerce-blocks/pull/199)
* Update textdomain in JS files

* Update textdomain in PHP files

* Add babel plugin to create pot & php files from JS

* Update textdomain in plugin header

* Update translations after rebase
2018-12-04 09:51:21 -05:00
Kelly Dwan 6572b79708 Category Selection: Add loading & no results states (https://github.com/woocommerce/woocommerce-blocks/pull/197)
* Add gridicons dependency

* Add loading & no results states

* Update test snapshots

* Remove redundant setState call
2018-12-03 19:17:22 -05:00
Kelly Dwan 5966050367 Add `woocommerce` as a supported keyword for the block (https://github.com/woocommerce/woocommerce-blocks/pull/198) 2018-12-03 19:17:10 -05:00
Kelly Dwan f0f62b5caa Category Selection: Always show "selected" section (https://github.com/woocommerce/woocommerce-blocks/pull/192)
* Always show the selected tags section, with a min-height to prevent jumping when selecting tags

* Only show the “clear all” button if there are selected items

* Update snapshot tests

* Update height for sidebar category selection
2018-12-03 16:05:12 -05:00
Kelly Dwan 50aa551268 Prevent scrollbar on bottom of category selection screen (https://github.com/woocommerce/woocommerce-blocks/pull/191)
Only show vertical scrollbar if the container is scrollable
2018-12-03 13:06:47 -05:00
Kelly Dwan 46cc38e3be Add the first category to deeply nested items (https://github.com/woocommerce/woocommerce-blocks/pull/189) 2018-12-03 13:06:28 -05:00
Kelly Dwan e1f8e7d552 Update tests after markup changes in 182 (https://github.com/woocommerce/woocommerce-blocks/pull/190) 2018-12-03 12:29:44 -05:00
Kelly Dwan e8538ca0cd Update role/selected code to make it clear to screen reader users that items are selected 2018-12-03 11:25:54 -05:00
Kelly Dwan f1f1a324a0 Add a specific class wrapper to the SVG 2018-12-03 11:25:32 -05:00
Kelly Dwan 94db1a65cf Update snapshots with added icons 2018-12-03 11:10:24 -05:00
Kelly Dwan c4ca6b484d Add icon to product category list 2018-12-03 11:10:23 -05:00
Kelly Dwan 5b9e615d45 Add checked/unchecked icons next to each menu item 2018-12-03 11:10:23 -05:00
Kelly Dwan 3d5571093a Don’t hide selected elements, instead add selection toggle 2018-12-03 11:10:22 -05:00
Kelly Dwan b8bdc2bf27 Category Selection: Add hierarchy support for nested categories (https://github.com/woocommerce/woocommerce-blocks/pull/179)
* Add buildTermsTree to handle hierarchical list input

* Append items if their parent is not in the given list

* Add `breadcrumbs` property to hierarchical list

* Display the “breadcrumbs” parent categories when searching

* Use display properties

we’re providing alternative text for screen reader users, so we can just toggle display values for the prefix

* Add all parent categories to name provided for screen readers

* Display parent category when parent is a currently selected item

* Add the depth class to items in defaultRenderItem

* Add a test for a hierarchical item list

* Clean up hierarchy docblock & commented-out code

* Update proptype

* Update depth CSS so we still indent very nested categories
2018-11-30 16:37:58 -05:00
Kelly Dwan dc1c1f7370 Add tests for SearchListControl (https://github.com/woocommerce/woocommerce-blocks/pull/174) 2018-11-30 15:39:16 -05:00
Claudio Sanches 81605bae30 New custom endpoints (https://github.com/woocommerce/woocommerce-blocks/pull/162)
* Included PHPCS and git hooks

* Fixed coding standards

* New Products endpoint

* Fixed product controller schema

* Improved products controller schema and response

* New product categories controller

* Updated REST API base to match WooCommerce authentication

* Fixed products/categories endpoint

* Better docblock

* Product attributes controller

* Product attribute terms controller

* Update REST API urls

* Reverted PHPCS changes

* Check permission only once while fetching posts

* Included raw price

* Included sku to products endpoint response

* Fixed endpoints in unit test

* Fixed routes in unit tests

* Check and use subscriber, contributor and author rules in unit tests
2018-11-30 14:12:56 -05:00
James Koster e9b3b341e5 Adjust category list max-height (https://github.com/woocommerce/woocommerce-blocks/pull/177) 2018-11-30 10:50:23 -05:00
Kelly Dwan 649f79903c Show the Layout settings as open by default (https://github.com/woocommerce/woocommerce-blocks/pull/175) 2018-11-29 21:00:46 -05:00
Kelly Dwan 6873f803d6 Fix React warning for array items needed unique key props (https://github.com/woocommerce/woocommerce-blocks/pull/173) 2018-11-29 20:57:15 -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 6a50ebde8b Adds continuous integration testing with travis (https://github.com/woocommerce/woocommerce-blocks/pull/156)
* Add travis to run JS & CSS linting, JS tests, and PHPUnit tests

* Move API initiation out of the gutenberg/files check

So that php tests run without having to build the JS files

* Add very basic product endpoint tests

* Fix stylelint issues in CSS

* Remove e2e setup, replace with dependency setup

* Add missing install step

* Remove cache for now

* Add specific `har-validator` dependency because v 5.1.2 has disappeared

* Only run npm install for the JS test job

* Check for installed plugins

* Update install location

* Fix typo in plugin name

* Check the BRANCH variable, rather than TRAVIS_PULL_REQUEST_BRANCH, which is only set on PR runs

* Remove debug command

* A change to trigger CI

* Set the expected node & npm versions

* Remove copy-pasted command, does not apply
2018-11-27 12:12:48 -05:00
Kelly Dwan a4fb42fe3d Load only published products in the preview (https://github.com/woocommerce/woocommerce-blocks/pull/146)
* Load only published products in the preview

* Fix post status in legacy block too

* Filter searching for individual products to only search published products

* Update query tests with change
2018-11-26 11:03:26 -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