Skip to content

feat!: Refactor <Area> and <ContentArea> components#199

Merged
baptistegrimaud merged 2 commits intomainfrom
feat-API-changes-areas
Mar 25, 2025
Merged

feat!: Refactor <Area> and <ContentArea> components#199
baptistegrimaud merged 2 commits intomainfrom
feat-API-changes-areas

Conversation

@baptistegrimaud
Copy link
Copy Markdown
Contributor

@baptistegrimaud baptistegrimaud commented Mar 21, 2025

Description

Addresses #179.
Refactor and simplify <Area> and <AbsoluteArea> components (with breaking changes!).

Usages

To use a fixed JCR node content of a given page:

<AbsoluteArea name="yourContentNode" parent={yourPageNode}>

This would store (and create if it does not exist) the content node yourContentNode (of type "jnt:contentList") as a child node of yourPageNode (a JCRNodeWrapper).
For instance, to use the main node of the home page:

<AbsoluteArea name="main" parent={renderContext.getSite().getHome()} />

Or to use a different page (at a custom hierarchy):

<AbsoluteArea name="main" parent={renderContext.getSite().getNode("your-page/your-sub-page")} />

A content node relative to the current page can also be used:

<AbsoluteArea name="main" parent={currentNode} />

Which is equivalent to use a classic <Area>:

<Area name="main" />

@baptistegrimaud baptistegrimaud force-pushed the feat-API-changes-areas branch from e87c087 to 2effeab Compare March 21, 2025 15:10
@baptistegrimaud baptistegrimaud marked this pull request as ready for review March 21, 2025 17:28
@baptistegrimaud baptistegrimaud requested a review from a team as a code owner March 21, 2025 17:28
@baptistegrimaud
Copy link
Copy Markdown
Contributor Author

NB: the tests seem to fail because of Jahia/jcontent#1681

Copy link
Copy Markdown
Member

@dgriffon dgriffon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to rename the components to avoid the confusion with Area and AbsoluteArea that are not working the same way.

@baptistegrimaud
Copy link
Copy Markdown
Contributor Author

I would suggest to rename the components to avoid the confusion with AreaTag and AbsoluteAreaTag that are not working the same way.

It was actually decided to keep the existing Area and AbsoluteArea components names to avoid creating a third one...
But I agree that could lead to confusion to developers/integrators.

Comment thread javascript-modules-engine/tests/cypress/e2e/ui/absoluteAreaTest.cy.ts Outdated
Comment thread javascript-modules-library/src/core/server/components/AbsoluteArea.tsx Outdated
Comment thread javascript-modules-library/src/core/server/components/AbsoluteArea.tsx Outdated
Comment thread javascript-modules-library/src/core/server/components/AbsoluteArea.tsx Outdated
@baptistegrimaud baptistegrimaud force-pushed the feat-API-changes-areas branch from e0f8887 to 8b9806b Compare March 24, 2025 10:33
@GauBen
Copy link
Copy Markdown
Member

GauBen commented Mar 24, 2025

I pushed an update to the library readme, tell me if it's accurate

@baptistegrimaud baptistegrimaud force-pushed the feat-API-changes-areas branch from 94825eb to 512fe01 Compare March 24, 2025 10:58
@baptistegrimaud baptistegrimaud force-pushed the feat-API-changes-areas branch from 512fe01 to 74dcecd Compare March 25, 2025 07:37
@baptistegrimaud baptistegrimaud enabled auto-merge (squash) March 25, 2025 07:40
@baptistegrimaud baptistegrimaud force-pushed the feat-API-changes-areas branch from 74dcecd to d424f3c Compare March 25, 2025 07:42
@baptistegrimaud baptistegrimaud merged commit 3e55892 into main Mar 25, 2025
10 checks passed
@baptistegrimaud baptistegrimaud deleted the feat-API-changes-areas branch March 25, 2025 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide <Area areaAsSubNode>, limit the parameters of <Area> and <AbsoluteArea>

3 participants