Skip to content

Experimental: Add API for addons to inject full-view 'pages'#23081

Closed
ndelangen wants to merge 44 commits into
nextfrom
norbert/prototype-addon-page-api
Closed

Experimental: Add API for addons to inject full-view 'pages'#23081
ndelangen wants to merge 44 commits into
nextfrom
norbert/prototype-addon-page-api

Conversation

@ndelangen

@ndelangen ndelangen commented Jun 15, 2023

Copy link
Copy Markdown
Member

Extracted into steps PRs:

Router change:
#23292

Tabs accepting title as FC:
#23288

Addon interactions overhaul using title as FC and useAddonState:
#23291

Other addons:
#23298

The big bang:
#23307

children: ReactNode;
}
interface RoutePropsDefault {
path: string | RegExp;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It supports RegExp now!

);

export const childrenToList = (children: any, selected: string) =>
export const childrenToList = (children: TabsProps['children']) =>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The tabs component is due for a complete overhaul.
The API is has with the children being the interface was not a great idea of mine.

It was hard to get the title to show up and not lose state when the tab became active/inactive.

Comment thread code/ui/manager/src/app.tsx Outdated
Comment on lines 56 to 74
<S.Main {...mainProps} isFullscreen={!!mainProps.isFullscreen}>
<S.Preview {...previewProps} hidden={viewMode === 'settings'}>
<Preview id="main" />
</S.Preview>
<Route path={/^\/story|docs\//} hideOnly>
<S.Preview {...previewProps} hidden={false}>
<Preview id="main" />
</S.Preview>

<S.Panel {...panelProps} hidden={viewMode !== 'story'}>
<Panel />
</S.Panel>
<Route path="/story/" startsWith hideOnly>
<S.Panel {...panelProps} hidden={false}>
<Panel />
</S.Panel>
</Route>
</Route>

{pages.map(({ key, route: Route, render: Content }) => (
<Route key={key}>
{pages.map(({ key, route: Wrapper, render: Content }) => (
<Wrapper key={key}>
<Content />
</Route>
</Wrapper>
))}
</S.Main>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

settings is now no longer some special string anymore.

<Content />
</Route>
))}
export const Mobile = ({

@ndelangen ndelangen Jun 15, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The mobile view was such a mess, pages would show up, but then make it impossible to go back to canvas.

This needs more attentions and proper testing.
I suspect there's a range of pre-existing bugs still here

);
};

export const JSXTitles = () => {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Demonstrating addon titles being a React.FC

@ndelangen ndelangen closed this Jul 4, 2023
@stof stof deleted the norbert/prototype-addon-page-api branch August 2, 2023 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant