diff --git a/packages/js/product-editor/changelog/add-40211 b/packages/js/product-editor/changelog/add-40211 new file mode 100644 index 00000000000..184b0969f5f --- /dev/null +++ b/packages/js/product-editor/changelog/add-40211 @@ -0,0 +1,4 @@ +Significance: minor +Type: add + +The variations table should match the height of number of rows selected diff --git a/packages/js/product-editor/src/components/variations-table/styles.scss b/packages/js/product-editor/src/components/variations-table/styles.scss index 2c0191024c8..fc532c52ad3 100644 --- a/packages/js/product-editor/src/components/variations-table/styles.scss +++ b/packages/js/product-editor/src/components/variations-table/styles.scss @@ -3,6 +3,7 @@ @import "./pagination/styles.scss"; @import "./table-empty-state/styles.scss"; @import "./variations-filter/styles.scss"; +@import "./table-row-skeleton/styles.scss"; $table-row-height: calc($grid-unit * 9); @@ -39,11 +40,6 @@ $table-row-height: calc($grid-unit * 9); } } - &__table { - height: $table-row-height * 5; - overflow: auto; - } - &__selection { .components-checkbox-control__input[type="checkbox"] { &:not(:checked):not(:focus) { diff --git a/packages/js/product-editor/src/components/variations-table/table-row-skeleton/index.ts b/packages/js/product-editor/src/components/variations-table/table-row-skeleton/index.ts new file mode 100644 index 00000000000..91b9eeb5980 --- /dev/null +++ b/packages/js/product-editor/src/components/variations-table/table-row-skeleton/index.ts @@ -0,0 +1 @@ +export * from './table-row-skeleton'; diff --git a/packages/js/product-editor/src/components/variations-table/table-row-skeleton/styles.scss b/packages/js/product-editor/src/components/variations-table/table-row-skeleton/styles.scss new file mode 100644 index 00000000000..e3bcb9143a7 --- /dev/null +++ b/packages/js/product-editor/src/components/variations-table/table-row-skeleton/styles.scss @@ -0,0 +1,51 @@ +.woocommerce-table-row-skeleton { + @mixin skeleton { + @include placeholder(); + background-color: $gray-200; + border-radius: $grid-unit-05; + width: $grid-unit-30; + min-height: $grid-unit-30; + } + + display: grid; + grid-template-columns: 44px auto 25% 25% 88px; + padding: 0; + min-height: 9 * $grid-unit; + border: none; + align-items: center; + + &__checkbox { + @include skeleton(); + } + + &__attribute-option { + @include skeleton(); + width: 9 * $grid-unit; + } + + &__regular-price, + &__quantity { + @include skeleton(); + width: $grid-unit-80; + display: inline-block; + } + + &__visibility-icon { + @include skeleton(); + flex-shrink: 0; + } + + &__edit-link { + @include skeleton(); + width: $grid-unit-70; + height: $grid-unit-40 + $grid-unit-05; + flex-shrink: 0; + } + + &__menu-toggle { + @include skeleton(); + width: $grid-unit-40 + $grid-unit-05; + height: $grid-unit-40 + $grid-unit-05; + flex-shrink: 0; + } +} diff --git a/packages/js/product-editor/src/components/variations-table/table-row-skeleton/table-row-skeleton.tsx b/packages/js/product-editor/src/components/variations-table/table-row-skeleton/table-row-skeleton.tsx new file mode 100644 index 00000000000..e6b8e8fd3a9 --- /dev/null +++ b/packages/js/product-editor/src/components/variations-table/table-row-skeleton/table-row-skeleton.tsx @@ -0,0 +1,47 @@ +/** + * External dependencies + */ +import { createElement } from '@wordpress/element'; + +export function TableRowSkeleton() { + return ( +
+ ); +} diff --git a/packages/js/product-editor/src/components/variations-table/variations-table.tsx b/packages/js/product-editor/src/components/variations-table/variations-table.tsx index e1339e12af6..d029842ba8d 100644 --- a/packages/js/product-editor/src/components/variations-table/variations-table.tsx +++ b/packages/js/product-editor/src/components/variations-table/variations-table.tsx @@ -41,6 +41,7 @@ import { Pagination } from './pagination'; import { EmptyTableState } from './table-empty-state'; import { VariationsFilter } from './variations-filter'; import { useVariations } from './use-variations'; +import { TableRowSkeleton } from './table-row-skeleton'; const NOT_VISIBLE_TEXT = __( 'Not visible to customers', 'woocommerce' ); @@ -302,16 +303,6 @@ export const VariationsTable = forwardRef< return (