Skip to content

Commit

Permalink
fix(drawer): docs canvas without drawer & position demo
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Esteves <[email protected]>
  • Loading branch information
aesteves60 authored and dpellier committed Jan 17, 2025
1 parent f1f6db6 commit 920a2b4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
1 change: 0 additions & 1 deletion packages/ods/src/components/drawer/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
Fermentum malesuada nisi quis congue mi eget feugiat magna. Lobortis fringilla aliquet ultrices consectetur sociosqu netus nascetur erat. Tristique egestas nibh euismod vestibulum malesuada molestie pellentesque porttitor. Blandit tincidunt bibendum interdum suscipit torquent sodales sit. Sem cursus tristique odio parturient potenti cubilia nulla mattis natoque. Nulla fermentum nec euismod eros nisi aliquam in. Leo eget ex suspendisse montes amet cubilia penatibus ipsum.
Montes maecenas justo facilisi tristique ultricies maecenas mollis donec aptent. Atincidunt integer neque laoreet est finibus. Proin accumsan torquent ullamcorper in ornare rutrum. Aenean maximus blandit dignissim inceptos rutrum. Mus libero interdum libero nam porttitor arcu, interdum nostra consequat. Hendrerit quis rhoncus pulvinar netus lacus. Phasellus donec morbi libero dictum blandit fringilla ad est purus.
Quisque morbi suscipit potenti ut nullam aenean; litora fermentum efficitur. Proin fringilla enim tristique; lacinia fermentum dapibus vitae. Tellus montes praesent adipiscing enim euismod cursus nec quisque. Suscipit etiam lectus rutrum mollis, nisl rhoncus posuere ultrices quam. Tincidunt pellentesque varius curabitur ante ut accumsan. Turpis litora accumsan dapibus viverra inceptos pretium aptent. Parturient eu elementum praesent eget interdum iaculis commodo nisi lacinia. Conubia inceptos porta mi lacinia pharetra ligula. Pulvinar vulputate primis duis habitasse etiam feugiat dolor.

</p>

<button id="button-open-modal">open modal</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import styles from './canvasWithoutContext.module.css';

type Props = {
of: ModuleExports,
className?: string,
sourceState?: string,
}

// Remove the transform form to the element because it create a new stacking context
// https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context
const CanvasWithoutContext = ({ of }: Props) => {
const CanvasWithoutContext = ({ of, className, sourceState = 'none' }: Props) => {
return (
<Canvas of={ of } sourceState="none" className={ styles['canvas-without-context'] } />
<Canvas of={ of } sourceState={ sourceState } className={ `${className} ${styles['canvas-without-context']}` } />
);
};

Expand Down
21 changes: 13 additions & 8 deletions packages/storybook/stories/components/drawer/drawer.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,19 @@ export const Position: StoryObj = {
const drawerPosition = document.querySelector('#drawer-position');
[buttonLeft, buttonRight, buttonBottom, buttonTop].forEach((button) => button.addEventListener('click', () => {
drawerPosition.position = button.id.replace('button-drawer-', '');
if (drawerPosition.isOpen) {
drawerPosition.close();
} else {
drawerPosition.open();
}
}));
[buttonLeft, buttonRight, buttonBottom, buttonTop].forEach((button) =>
button.addEventListener('click', async() => {
const lastPosition = drawerPosition.position;
drawerPosition.position = button.id.replace('button-drawer-', '');
if (lastPosition !== drawerPosition.position && drawerPosition.isOpen) {
return;
}
if (drawerPosition.isOpen) {
await drawerPosition.close();
} else {
await drawerPosition.open();
}
}));
})();
</script>
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CanvasWithoutContext } from '../../../src/components/canvasWithoutConte

<Heading label="Overview" level={ 2 } />

<CanvasWithoutContext of={ DrawerStories.Overview } sourceState="none" />
<CanvasWithoutContext of={ DrawerStories.Overview } />

<TechnicalSpecification data={ SpecificationsDrawer } />

Expand Down

0 comments on commit 920a2b4

Please sign in to comment.