-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from newrelic/zstickles/intro-component-fixes
Intro & Step Component Bug Fixes
- Loading branch information
Showing
6 changed files
with
85 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import React from 'react'; | ||
import SideBySide from './SideBySide'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import styles from './Intro.module.scss'; | ||
import Proptypes from 'prop-types'; | ||
|
||
const Intro = ({ children }) => ( | ||
<div className={styles.container}>{children}</div> | ||
<SideBySide type="Video" className={styles.container}> | ||
{children} | ||
</SideBySide> | ||
); | ||
|
||
Intro.propTypes = { | ||
children: Proptypes.node.isRequired, | ||
children: PropTypes.node.isRequired, | ||
}; | ||
|
||
export default Intro; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
.container { | ||
display: flex; | ||
p { | ||
width: 50%; | ||
color: var(--color-neutrals-600); | ||
font-size: 1.125rem; | ||
line-height: 2rem; | ||
margin-right: 1rem; | ||
} | ||
div { | ||
width: 50%; | ||
margin-left: 1rem; | ||
} | ||
.container p { | ||
color: var(--color-neutrals-600); | ||
font-size: 1.125rem; | ||
line-height: 2rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import cx from 'classnames'; | ||
|
||
import styles from './SideBySide.module.scss'; | ||
|
||
const SideBySide = ({ className, children, type, dir }) => { | ||
const childObjects = React.Children.toArray(children); | ||
const side = childObjects.find((child) => child?.props?.mdxType === type); | ||
const rest = childObjects.filter((child) => child !== side); | ||
|
||
return ( | ||
<div className={cx(className, styles.container, styles[dir])}> | ||
<div>{rest}</div> | ||
{side && <div>{side}</div>} | ||
</div> | ||
); | ||
}; | ||
|
||
SideBySide.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
type: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
dir: PropTypes.oneOf(['right', 'left']), | ||
}; | ||
|
||
SideBySide.defaultProps = { | ||
dir: 'right', | ||
}; | ||
|
||
export default SideBySide; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.container { | ||
display: flex; | ||
|
||
> div { | ||
flex: 1; | ||
} | ||
|
||
&.right { | ||
flex-direction: row; | ||
|
||
> div:nth-child(2) { | ||
margin-left: 1rem; | ||
} | ||
} | ||
|
||
&.left { | ||
flex-direction: row-reverse; | ||
|
||
> div:nth-child(2) { | ||
margin-right: 1rem; | ||
} | ||
} | ||
|
||
@media (max-width: 760px) { | ||
display: block; | ||
|
||
&.left > div:nth-child(2), | ||
&.right > div:nth-child(2) { | ||
margin: 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters