Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WRP-21128: Fixed components used in enact/ui/Layout/Cell which cannot have their css customized in consumer apps. #3162

Merged
merged 9 commits into from
Mar 22, 2024
6 changes: 6 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The following is a curated list of changes in the Enact ui module, newest changes on the top.

## [unreleased]

### Added

- `ui/Layout.Cell` prop `componentCss` to support customizing the component used in `Cell`

## [4.8.0] - 2024-02-08

No significant changes.
Expand Down
17 changes: 14 additions & 3 deletions packages/ui/Layout/Cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,21 @@ const CellBase = kind({
*/
component: EnactPropTypes.renderable,

/**
* Customizes `Cell` together with `component` prop.
*
* When using {@link ui/Layout.Cell}, the `componentCss` prop is passed to the rendered component
* as `css`.
*
* @type {Object}
* @public
*/
componentCss: PropTypes.object,

/**
* Called with a reference to the root component.
*
* When using {@link ui/Layout.Cell}, the `ref` prop is forwarded to this component
* When using {@link ui/Layout.Cell}, the `ref` prop is forwarded to the rendered component
* as `componentRef`.
*
* @type {Object|Function}
Expand Down Expand Up @@ -162,13 +173,13 @@ const CellBase = kind({
}
},

render: ({component: Component, componentRef, ...rest}) => {
render: ({component: Component, componentCss, componentRef, ...rest}) => {
delete rest.align;
delete rest.grow;
delete rest.shrink;
delete rest.size;

return <Component ref={componentRef} {...rest} />;
return <Component css={componentCss} ref={componentRef} {...rest} />;
}
});

Expand Down
Loading