-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
19 changed files
with
302 additions
and
544 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
examples/state_containers_examples/public/common/example_page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import React, { PropsWithChildren } from 'react'; | ||
import { EuiPage, EuiPageSideBar, EuiSideNav } from '@elastic/eui'; | ||
import { CoreStart } from '../../../../src/core/public'; | ||
|
||
export interface ExampleLink { | ||
title: string; | ||
appId: string; | ||
} | ||
|
||
interface NavProps { | ||
navigateToApp: CoreStart['application']['navigateToApp']; | ||
exampleLinks: ExampleLink[]; | ||
} | ||
|
||
const SideNav: React.FC<NavProps> = ({ navigateToApp, exampleLinks }: NavProps) => { | ||
const navItems = exampleLinks.map((example) => ({ | ||
id: example.appId, | ||
name: example.title, | ||
onClick: () => navigateToApp(example.appId), | ||
'data-test-subj': example.appId, | ||
})); | ||
|
||
return ( | ||
<EuiSideNav | ||
items={[ | ||
{ | ||
name: 'State management examples', | ||
id: 'home', | ||
items: [...navItems], | ||
}, | ||
]} | ||
/> | ||
); | ||
}; | ||
|
||
interface Props { | ||
navigateToApp: CoreStart['application']['navigateToApp']; | ||
exampleLinks: ExampleLink[]; | ||
} | ||
|
||
export const StateContainersExamplesPage: React.FC<Props> = ({ | ||
navigateToApp, | ||
children, | ||
exampleLinks, | ||
}: PropsWithChildren<Props>) => { | ||
return ( | ||
<EuiPage> | ||
<EuiPageSideBar> | ||
<SideNav navigateToApp={navigateToApp} exampleLinks={exampleLinks} /> | ||
</EuiPageSideBar> | ||
{children} | ||
</EuiPage> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.