Update docz after callouts
This commit is contained in:
parent
993c46022c
commit
2131cb5abb
@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: ModalProvider
|
name: ModalProvider
|
||||||
menu: Context Providers
|
route: customHooks/modalProvider
|
||||||
route: contextProviders/modalProvider
|
|
||||||
---
|
---
|
||||||
|
|
||||||
import { Props } from 'docz';
|
import { Props } from 'docz';
|
||||||
@ -50,7 +49,25 @@ import { withModal } from '@ohif/ui';
|
|||||||
const SampleComponent = () => {
|
const SampleComponent = () => {
|
||||||
const { show, hide } = useModal();
|
const { show, hide } = useModal();
|
||||||
|
|
||||||
return;
|
const openModal = () => {
|
||||||
|
show({
|
||||||
|
content: <div> Modal Content </div>,
|
||||||
|
title: 'Modal title',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeModal = () => {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button onClick={openModal}>
|
||||||
|
Open modal
|
||||||
|
</button>
|
||||||
|
<button onClick={closeModal}>
|
||||||
|
Close modal
|
||||||
|
</button>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SampleComponent;
|
export default SampleComponent;
|
||||||
@ -69,10 +86,26 @@ import { withModal } from '@ohif/ui';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
class SampleComponent extends React.Component {
|
class SampleComponent extends React.Component {
|
||||||
const { show, hide } = props.modal;
|
openModal() {
|
||||||
|
this.props.modal.show({
|
||||||
|
content: <div> Modal Content </div>,
|
||||||
|
title: 'Modal title',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal() = {
|
||||||
|
this.props.modal.hide();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return;
|
return (
|
||||||
|
<button onClick={this.openModal}>
|
||||||
|
Open modal
|
||||||
|
</button>
|
||||||
|
<button onClick={this.closeModal}>
|
||||||
|
Close modal
|
||||||
|
</button>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export const Sidebar = React.forwardRef((props, ref) => {
|
|||||||
const menus = useMenus({ query });
|
const menus = useMenus({ query });
|
||||||
const currentDoc = useCurrentDoc();
|
const currentDoc = useCurrentDoc();
|
||||||
const currentDocRef = useRef();
|
const currentDocRef = useRef();
|
||||||
const handleChange = (ev) => {
|
const handleChange = ev => {
|
||||||
setQuery(ev.target.value);
|
setQuery(ev.target.value);
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -26,6 +26,7 @@ export const Sidebar = React.forwardRef((props, ref) => {
|
|||||||
|
|
||||||
const customMenus = {
|
const customMenus = {
|
||||||
Components: [],
|
Components: [],
|
||||||
|
'Custom Hooks': [],
|
||||||
System: [],
|
System: [],
|
||||||
Examples: [],
|
Examples: [],
|
||||||
};
|
};
|
||||||
@ -39,25 +40,26 @@ export const Sidebar = React.forwardRef((props, ref) => {
|
|||||||
'Data Display',
|
'Data Display',
|
||||||
'Other',
|
'Other',
|
||||||
],
|
],
|
||||||
|
'Custom Hooks': ['ModalProvider'],
|
||||||
Examples: ['Views'],
|
Examples: ['Views'],
|
||||||
System: ['Colors'],
|
System: ['Colors'],
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderMenuCategories = () => {
|
const renderMenuCategories = () => {
|
||||||
return Object.keys(customMenus).map((menuName) => {
|
return Object.keys(customMenus).map(menuName => {
|
||||||
return (
|
return (
|
||||||
<div key={menuName}>
|
<div key={menuName}>
|
||||||
<h2 className="pl-2 border-l-8 -ml-4 border-secondary-active">
|
<h2 className="pl-2 border-l-8 -ml-4 border-secondary-active">
|
||||||
{menuName}
|
{menuName}
|
||||||
</h2>
|
</h2>
|
||||||
{customMenus[menuName].map((item) => item)}
|
{customMenus[menuName].map(item => item)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMenuCategory = (menuName) => {
|
const getMenuCategory = menuName => {
|
||||||
return Object.keys(MENU_CATEGORIES).find((category) => {
|
return Object.keys(MENU_CATEGORIES).find(category => {
|
||||||
if (MENU_CATEGORIES[category].includes(menuName)) {
|
if (MENU_CATEGORIES[category].includes(menuName)) {
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
@ -97,7 +99,7 @@ export const Sidebar = React.forwardRef((props, ref) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
/>
|
/>
|
||||||
{menus &&
|
{menus &&
|
||||||
menus.map((menu) => {
|
menus.map(menu => {
|
||||||
const isGroup = !!menu.menu;
|
const isGroup = !!menu.menu;
|
||||||
const Component = isGroup ? NavGroup : NavLink;
|
const Component = isGroup ? NavGroup : NavLink;
|
||||||
const menuCategory = getMenuCategory(menu.name) || null;
|
const menuCategory = getMenuCategory(menu.name) || null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user