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

[Storybook] Add stories for more components (letter P) - Part 1 #7648

Merged
merged 20 commits into from
Apr 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions src/components/page_template/page_template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,25 @@ export const _EuiPageTemplate: FunctionComponent<EuiPageTemplateProps> = ({
});

// Sections include page header
const sections: React.ReactElement[] = [];
const sidebar: React.ReactElement[] = [];

React.Children.toArray(children).forEach((child) => {
if (!React.isValidElement(child)) return; // Skip non-components

if (
child.type === _EuiPageSidebar ||
child.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__ === _EuiPageSidebar
) {
sidebar.push(child);
} else {
sections.push(child);
}
});
const [sidebar, sections] = useMemo(() => {
mgadewoll marked this conversation as resolved.
Show resolved Hide resolved
const sidebar: React.ReactElement[] = [];
const sections: React.ReactElement[] = [];

React.Children.toArray(children).forEach((child) => {
if (!React.isValidElement(child)) return; // Skip non-components

if (
child.type === _EuiPageSidebar ||
child.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__ === _EuiPageSidebar
) {
sidebar.push(child);
} else {
sections.push(child);
}
});

return [sidebar, sections];
}, [children]);

const classes = classNames('euiPageTemplate', className);
const pageStyle = useMemo(
Expand Down
Loading