Skip to content

Commit

Permalink
fix(#2755): make offcanvas example code readable (#2768)
Browse files Browse the repository at this point in the history
  • Loading branch information
illiteratewriter authored Sep 28, 2023
1 parent a5ac201 commit b932582
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
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;
Original file line number Diff line number Diff line change
@@ -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 b932582

Please sign in to comment.