-
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.
Added alternate List view for all packs which is responsive to view size Changed the name of a couple of components to keep them in line with functionality: `PackList` -> `PackGrid` (the list view uses `PackList` and vice-versa `PackTile` -> `PackGridTile` (to differentiate from `PackListTile`
- Loading branch information
1 parent
2c97811
commit 82adc31
Showing
5 changed files
with
228 additions
and
34 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import { css } from '@emotion/react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const PackGrid = ({ children, className }) => { | ||
return ( | ||
<div | ||
className={className} | ||
css={css` | ||
display: grid; | ||
grid-template-columns: repeat(4, minmax(260px, 1fr)); | ||
grid-gap: 1rem; | ||
grid-auto-rows: minmax(var(--guide-list-row-height, 150px), auto); | ||
align-items: stretch; | ||
width: 100%; | ||
@media (max-width: 1180px) { | ||
grid-template-columns: 1fr; | ||
grid-gap: 3rem; | ||
} | ||
`} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
PackGrid.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default PackGrid; |
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
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,120 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { css } from '@emotion/react'; | ||
import { Link, Icon, Surface } from '@newrelic/gatsby-theme-newrelic'; | ||
|
||
const PackListTile = ({ | ||
name, | ||
description, | ||
featuredImageUrl, | ||
supportLevel, | ||
to, | ||
className, | ||
}) => ( | ||
<Surface | ||
as={Link} | ||
to={to} | ||
className={className} | ||
base={Surface.BASE.PRIMARY} | ||
interactive | ||
css={css` | ||
display: grid; | ||
border-radius: 0.25rem; | ||
position: relative; | ||
transition: all 0.15s ease-out; | ||
margin-bottom: 1rem; | ||
`} | ||
> | ||
<div | ||
css={css` | ||
display: grid; | ||
grid-template-columns: 1fr 3fr; | ||
grid-auto-rows: minmax(var(--guide-list-row-height, 150px), auto); | ||
@media (max-width: 1080px) { | ||
grid-template-columns: 1fr; | ||
} | ||
`} | ||
> | ||
<div | ||
css={css` | ||
padding: 1rem; | ||
max-height: 150px; | ||
@media (max-width: 1080px) { | ||
display: none; | ||
} | ||
`} | ||
> | ||
{featuredImageUrl && ( | ||
<img | ||
src={featuredImageUrl} | ||
alt="Preview of the pack in action" | ||
css={css` | ||
display: block; | ||
object-fit: cover; | ||
width: 100%; | ||
height: 100%; | ||
@media (max-width: 1080px) { | ||
display: none; | ||
} | ||
`} | ||
/> | ||
)} | ||
</div> | ||
<div | ||
css={css` | ||
padding: 1rem; | ||
width: 100%; | ||
`} | ||
> | ||
<div | ||
css={css` | ||
display: grid; | ||
grid-template-columns: 1fr auto; | ||
grid-gap: 0.5rem; | ||
align-items: baseline; | ||
`} | ||
> | ||
<h4> | ||
{name}{' '} | ||
{supportLevel === 'NEWRELIC' && ( | ||
<span title="New Relic supported"> | ||
<Icon | ||
css={css` | ||
stroke: none; | ||
width: 2rem; | ||
height: 2rem; | ||
`} | ||
name="nr-check-shield" | ||
/> | ||
</span> | ||
)} | ||
</h4> | ||
</div> | ||
<p | ||
css={css` | ||
font-size: 0.875rem; | ||
color: var(--secondary-text-color); | ||
flex: 1; | ||
text-align: left; | ||
padding: 0; | ||
`} | ||
> | ||
{description} | ||
</p> | ||
</div> | ||
</div> | ||
</Surface> | ||
); | ||
|
||
PackListTile.propTypes = { | ||
name: PropTypes.string.isRequired, | ||
description: PropTypes.string.isRequired, | ||
featuredImageUrl: PropTypes.string, | ||
supportLevel: PropTypes.string, | ||
to: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default PackListTile; |
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