adobe / aio-theme

The Adobe I/O theme for building markdown powered sites
Apache License 2.0
72 stars 43 forks source link

fix: table not responding to parent size change #1516

Closed dmitrymatio closed 1 year ago

dmitrymatio commented 1 year ago

Description

Table will now assign the same width as our main content column (MOBILE_SCREEN_WIDTH) by default and immediately starts observing the parent element for size changes using useParentSize util. If the parent element width is not 0 it will resize the Table to match.

I added useParentSize which is based on this package's code but stripped down from TS and modified to actually grab the parent elements size from the Table ref.

Related Issue

DEVSITE-755

Motivation and Context

Table wasn't resizing correctly when nested in a parent element with fickle width size.

How Has This Been Tested?

Tested in the example and aep-mobile-sdk pages with tables.

Screenshots (if appropriate):

Types of changes

Checklist: