Skip to content

Commit

Permalink
Merge branch 'master' into jerel/guide-tiles-tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller authored Jun 29, 2020
2 parents 4feac2a + fd3e770 commit 123b15b
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 34 deletions.
17 changes: 16 additions & 1 deletion src/components/GuideTile/GuideTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ const GuideTile = ({
description,
className,
children,
alignment,
...props
}) => (
<Component
{...props}
className={cx(styles.tile, className, { [styles.tileWithIcon]: icon })}
className={cx(styles.tile, className, {
[styles.tileWithIcon]: icon,
[styles.tileLeftAligned]: alignment === GuideTile.ALIGNMENT.LEFT,
[styles.tileCenterAligned]: alignment === GuideTile.ALIGNMENT.CENTER,
})}
>
{icon && (
<div className={styles.iconContainer}>
Expand All @@ -42,6 +47,11 @@ const GuideTile = ({

GuideTile.Button = Button;

GuideTile.ALIGNMENT = {
LEFT: 'left',
CENTER: 'center',
};

GuideTile.propTypes = {
duration: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
Expand All @@ -50,6 +60,11 @@ GuideTile.propTypes = {
icon: PropTypes.string,
children: PropTypes.node,
as: PropTypes.elementType,
alignment: PropTypes.oneOf(Object.values(GuideTile.ALIGNMENT)),
};

GuideTile.defaultProps = {
alignment: GuideTile.ALIGNMENT.CENTER,
};

export default GuideTile;
26 changes: 20 additions & 6 deletions src/components/GuideTile/GuideTile.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
margin-top: 1rem;
}

.title,
.description {
text-align: center;
}

.timeEstimate {
font-size: 0.75rem;
display: flex;
Expand Down Expand Up @@ -48,7 +43,6 @@
margin-bottom: 1.5rem;
color: var(--color-neutrals-600);
flex: 1;
padding: 0 0.5rem;

&:last-child {
margin-bottom: 0;
Expand All @@ -66,3 +60,23 @@
.timeIcon {
margin-right: 0.25rem;
}

.tileLeftAligned {
.title,
.description {
text-align: left;
}
.description {
padding: 0;
}
}

.tileCenterAligned {
.title,
.description {
text-align: center;
}
.description {
padding: 0 0.5rem;
}
}
1 change: 0 additions & 1 deletion src/data/sidenav.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
},
{
"displayName": "Explore docs",
"url": "/explore-docs",
"children": [
{
"displayName": "New Relic One CLI",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
path: '/guides/5-min-tag-resources'
path: '/automate-workflows/5-min-tag-resources'
duration: '5 min'
title: 'Quickly tag a set of resources'
template: 'GuideTemplate'
Expand Down
14 changes: 0 additions & 14 deletions src/markdown-pages/explore-docs/index.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ const IndexPage = ({ data, pageContext }) => {
<GuideTile
as={Link}
to={frontmatter.path}
className={styles.allGuidesGuide}
key={index}
duration={frontmatter.duration}
title={frontmatter.tileShorthand?.title || frontmatter.title}
Expand All @@ -143,6 +142,7 @@ const IndexPage = ({ data, pageContext }) => {
frontmatter.description
}
path={frontmatter.path}
alignment={GuideTile.ALIGNMENT.LEFT}
/>
))}
</GuideListing.List>
Expand Down
10 changes: 0 additions & 10 deletions src/pages/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,3 @@
.allGuidesListing {
margin-top: 1rem;
}

.allGuidesGuide {
p,
h2 {
text-align: left;
}
p {
padding: 0;
}
}
1 change: 1 addition & 0 deletions src/templates/OverviewTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const OverviewTemplate = ({ data }) => {
frontmatter.description
}
path={frontmatter.path}
alignment={GuideTile.ALIGNMENT.LEFT}
/>
))}
</GuideListing.List>
Expand Down

0 comments on commit 123b15b

Please sign in to comment.