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

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

Closed
wants to merge 44 commits into from

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Jun 15, 2023

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
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!

@@ -10,25 +12,41 @@ export const VisuallyHidden = styled.div<VisuallyHiddenProps>(({ active }) =>
active ? { display: 'block' } : { display: 'none' }
);

export const childrenToList = (children: any, selected: string) =>
export const childrenToList = (children: TabsProps['children']) =>
Copy link
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 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
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 = ({
Copy link
Member Author

@ndelangen ndelangen Jun 15, 2023

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

@@ -25,6 +26,115 @@ export const Default = () => {
);
};

export const JSXTitles = () => {
Copy link
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.

None yet

1 participant