Skip to content
This repository was archived by the owner on Apr 7, 2025. It is now read-only.

Commit 38c315b

Browse files
committed
feat: add collections landing page
1 parent a357c12 commit 38c315b

File tree

4 files changed

+173
-4
lines changed

4 files changed

+173
-4
lines changed

src/components/HomepageCollection.module.scss

+13-1
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,16 @@
154154
.project {
155155
animation-duration: 30s;
156156
}
157-
}
157+
}
158+
159+
// ==============================================================
160+
// Dark mode styles
161+
// =============================================================
162+
163+
:global(.dark-mode) {
164+
.homepage-collection:before {
165+
166+
background: linear-gradient(0deg, rgba(0,0,0, .2) 23.26%, var(--color-neutrals-100));
167+
168+
}
169+
}

src/components/PageHeading.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const PageHeading = props => {
6969
!hasIcon && props.hasSeparator ? styles.hasSeparatorWithoutIcon : ''
7070
} ${props.icon ? styles.hasIcon : ''} ${
7171
props.callToAction ? styles.hasCallToAction : ''
72-
}`}
72+
} ${props.className ? props.className : ''}`}
7373
>
7474
{hasIcon && props.showIcon && (
7575
<div className={styles.pageHeadingIconContainer}>
@@ -112,7 +112,8 @@ PageHeading.propTypes = {
112112
hasSeparator: PropTypes.bool,
113113
blogMeta: PropTypes.string,
114114
callToAction: PropTypes.func,
115-
darkMode: PropTypes.object
115+
darkMode: PropTypes.object,
116+
className: PropTypes.string
116117
};
117118

118119
export default withDarkMode(PageHeading);

src/pages/collection.module.scss

+54-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
height: 10000px;
3131
background-color: var(--color-neutrals-100);
3232
width: 100%;
33-
transform: skewY(-2deg) translateY(-30px);
33+
transform: skewY(-2deg) translateY(-70px);
3434
z-index:-1;
3535
}
3636
}
@@ -59,6 +59,7 @@
5959
}
6060

6161
.collection-listing {
62+
position: relative;
6263
margin-bottom: 40px;
6364
display: grid;
6465
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
@@ -75,6 +76,58 @@
7576
}
7677
}
7778

79+
.collections-page {
80+
.collection-listing-container {
81+
margin-top: 70px;
82+
}
83+
84+
.collection-listing-header-section {
85+
padding-bottom: 12px;
86+
margin-bottom: 20px;
87+
}
88+
89+
.collection-listing-header-section-heading {
90+
display: inline;
91+
margin-right: 10px;
92+
}
93+
94+
.collection-listing-header-section-description {
95+
display: inline;
96+
}
97+
98+
.collection-listing:after {
99+
content: "";
100+
display: block;
101+
width: 150px;
102+
height: calc(100% + 25px);
103+
position: absolute;
104+
top: -1px;
105+
right: -9px;
106+
z-index: 1000;
107+
108+
109+
background: linear-gradient(270deg, #F4F5F5 34.6%, rgba(244, 245, 245, 0) 78.29%);
110+
}
111+
112+
.page-heading {
113+
margin-bottom: 100px;
114+
}
115+
}
116+
117+
.collections-page-collection-link {
118+
display: flex;
119+
align-items: center;
120+
font-size: 13px;
121+
font-weight: 600;
122+
letter-spacing: .07em;
123+
text-transform: uppercase;
124+
border: none;
125+
126+
svg {
127+
transform: scale(.75) translateY(-1.5px);
128+
}
129+
}
130+
78131
// ==============================================================
79132
// Responsive styles
80133
// ==============================================================

src/pages/collections.js

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { graphql } from 'gatsby';
4+
import Layout from '../components/layout';
5+
import SEO from '../components/seo';
6+
import PageHeading from '../components/PageHeading';
7+
import SimpleProjectModule from '../components/SimpleProjectModule';
8+
import { startCase } from 'lodash';
9+
import { ChevronRight } from 'react-feather';
10+
11+
import styles from './collection.module.scss';
12+
13+
export const query = graphql`
14+
query allCollections($path: String) {
15+
nerdpacks: allProjects(
16+
filter: {
17+
projectType: { eq: "newrelic" }
18+
projectTags: { elemMatch: { slug: { eq: "nr1-app" } } }
19+
}
20+
) {
21+
edges {
22+
node {
23+
...exploreProjectsFields
24+
}
25+
}
26+
}
27+
28+
layouts: allProjects(filter: { name: { regex: "/layout/" } }) {
29+
edges {
30+
node {
31+
...exploreProjectsFields
32+
}
33+
}
34+
}
35+
sitePage: allSitePage(filter: { path: { eq: $path } }) {
36+
nodes {
37+
fields {
38+
contentEditLink
39+
}
40+
componentPath
41+
path
42+
}
43+
}
44+
}
45+
`;
46+
47+
const CollectionPage = ({ data }) => {
48+
const allCollections = Object.entries(data);
49+
return (
50+
<Layout fullWidth className={`${styles.collectionPage} ${styles.collectionsPage}`}>
51+
<SEO title="Open source projects to which New Relic contributes" />
52+
<PageHeading
53+
title="Highlighted projects"
54+
subheader="Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum."
55+
className={styles.pageHeading}
56+
/>
57+
{allCollections.map((collection, i) => {
58+
if (collection[0] !== 'sitePage') {
59+
return (
60+
<>
61+
<div className={styles.collectionListingContainer}>
62+
<header className={styles.collectionListingHeaderSection}>
63+
<div>
64+
<h4 className={styles.collectionListingHeaderSectionHeading}>
65+
{startCase(collection[0])}
66+
</h4>
67+
<p className={styles.collectionListingHeaderSectionDescription}>
68+
Explore the open source repositories for New Relic agent technology
69+
</p>
70+
</div>
71+
<a href="#" className={styles.collectionsPageCollectionLink}>
72+
View all {collection[1].edges.length} projects
73+
<ChevronRight />
74+
</a>
75+
</header>
76+
<div className={styles.collectionListing}>
77+
{collection[1].edges.map((project, i) => {
78+
if (i < 4) {
79+
return (
80+
<SimpleProjectModule
81+
key={project.node.id}
82+
data={project.node}
83+
className={styles.project}
84+
/>
85+
);
86+
}
87+
88+
})}
89+
</div>
90+
</div>
91+
</>
92+
);
93+
}
94+
})}
95+
</Layout>
96+
);
97+
};
98+
99+
CollectionPage.propTypes = {
100+
data: PropTypes.object
101+
};
102+
103+
export default CollectionPage;

0 commit comments

Comments
 (0)