Skip to content

Commit

Permalink
chore: simplified step component
Browse files Browse the repository at this point in the history
  • Loading branch information
zstix committed Jun 5, 2020
1 parent 906c36d commit 95fb3d2
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/components/Step.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
import React from 'react';
import Proptypes from 'prop-types';
import cx from 'classnames';
import SideBySide from './SideBySide';

import styles from './Step.module.scss';

const Step = ({ children, number, total }) => {
children = React.Children.toArray(children);
const codeSnippet = children.find((child) => child?.props?.mdxType === 'pre');
const childrenWithoutCodeSnippet = children.filter(
(child) => child !== codeSnippet
);

return (
<div className={styles.wrapper}>
<p className={styles.stepNumber}>{`Step ${number} of ${total}`}</p>
<div className={styles.stepDetails}>
<SideBySide type="pre">{children}</SideBySide>
</div>
const Step = ({ children, number, total }) => (
<div className={styles.wrapper}>
<p className={styles.stepNumber}>{`Step ${number} of ${total}`}</p>
<div className={styles.stepDetails}>
<SideBySide type="pre">{children}</SideBySide>
</div>
);
};
</div>
);

Step.propTypes = {
children: Proptypes.node.isRequired,
Expand Down

0 comments on commit 95fb3d2

Please sign in to comment.