Skip to content

Commit

Permalink
fix(reactstrap#2755): make offcanvas example code readable
Browse files Browse the repository at this point in the history
  • Loading branch information
illiteratewriter committed Sep 10, 2023
1 parent 61f2453 commit c0df8e0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 17 deletions.
5 changes: 4 additions & 1 deletion src/Offcanvas.js
Expand Up @@ -241,7 +241,10 @@ class Offcanvas extends React.Component {
}

setFocus() {
if (this._dialog.current && typeof this._dialog.current.focus === 'function') {
if (
this._dialog.current &&
typeof this._dialog.current.focus === 'function'
) {
this._dialog.current.focus();
}
}
Expand Down
4 changes: 2 additions & 2 deletions stories/Offcanvas.stories.js
Expand Up @@ -13,5 +13,5 @@ export default {
},
};

export { default as Offcanvas } from './examples/Offcanvas';
export { default as Props } from './examples/OffcanvasProps';
export { default as Offcanvas } from './examples/Offcanvas/Offcanvas';
export { default as Props } from './examples/Offcanvas/OffcanvasProps';
28 changes: 28 additions & 0 deletions stories/examples/Offcanvas/Offcanvas.js
@@ -0,0 +1,28 @@
import Example from './OffcanvasExample';
// eslint-disable-next-line import/extensions
import OffcanvasExample from '!!raw-loader!./OffcanvasExample';

Example.parameters = {
docs: {
source: {
code: OffcanvasExample,
language: 'jsx',
type: 'auto',
},
},
};

Example.args = {
backdrop: true,
fade: true,
scrollable: false,
};

Example.argTypes = {
direction: {
control: { type: 'select' },
options: ['top', 'start', 'end', 'bottom'],
},
};

export default Example;
Expand Up @@ -25,17 +25,4 @@ function Example(args) {
);
}

Example.args = {
backdrop: true,
fade: true,
scrollable: false,
};

Example.argTypes = {
direction: {
control: { type: 'select' },
options: ['top', 'start', 'end', 'bottom'],
},
};

export default Example;
@@ -1,6 +1,6 @@
import React from 'react';
import { Offcanvas, OffcanvasBody, OffcanvasHeader } from 'reactstrap';
import Props from './Props';
import Props from '../Props';

function Example() {
return <Props components={[Offcanvas, OffcanvasBody, OffcanvasHeader]} />;
Expand Down

0 comments on commit c0df8e0

Please sign in to comment.