Skip to content

Commit

Permalink
Site editor routes: add docs for areas and prevent edit area from r…
Browse files Browse the repository at this point in the history
…endering when canvas is `edit` (WordPress#66309)

Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
  • Loading branch information
3 people authored Oct 22, 2024
1 parent a4aeb1a commit 0b76a25
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,18 @@ export default function Layout( { route } ) {
</div>
) }

{ ! isMobileViewport && areas.edit && (
<div
className="edit-site-layout__area"
style={ {
maxWidth: widths?.edit,
} }
>
{ areas.edit }
</div>
) }
{ ! isMobileViewport &&
areas.edit &&
canvasMode !== 'edit' && (
<div
className="edit-site-layout__area"
style={ {
maxWidth: widths?.edit,
} }
>
{ areas.edit }
</div>
) }

{ ! isMobileViewport && areas.preview && (
<div className="edit-site-layout__canvas-container">
Expand Down
20 changes: 20 additions & 0 deletions packages/edit-site/src/components/site-editor-routes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Site Editor Routes

## Areas

When `canvasMode` is not `edit`, the areas avaliable to use are:

| Area | Non-mobile viewport | Mobile viewport |
| --- | --- | --- |
| `sidebar` | Always rendered. | Only if `mobile` is not provided. |
| `content` | Rendered if provided. | Not rendered. |
| `preview` | Rendered if provided. | Not rendered. |
| `edit` | Rendered if provided. | Not rendered. |
| `mobile` | Not rendered | Rendered as full-screen, if provided. |

When `canvasMode` is `edit`, the areas avaliable to use are:

| Area | Non-mobile viewport | Mobile viewport |
| --- | --- | --- |
| `preview` | Rendered as full-screen, if provided. Otherwise, it'll display an empty blank sidebar. | Not rendered. |
| `mobile` | Not rendered | Rendered as full-screen, if provided. Otherwise, it'll display an empty blank sidebar. |

0 comments on commit 0b76a25

Please sign in to comment.