Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new styles for subtask in lab #2033

Merged
merged 5 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/components/GuideTile/GuideTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import PropTypes from 'prop-types';
import { css } from '@emotion/react';
import { Link, Icon, Surface } from '@newrelic/gatsby-theme-newrelic';

const GuideTile = ({ duration, title, description, className, to }) => (
const GuideTile = ({
duration,
title,
description,
className,
to,
procIdxIsInteger,
}) => (
<Surface
as={Link}
to={to}
Expand All @@ -13,6 +20,8 @@ const GuideTile = ({ duration, title, description, className, to }) => (
css={css`
display: grid;
grid-template-rows: auto 1fr auto;
width: ${procIdxIsInteger ? '100%' : '90%'};
margin-left: ${procIdxIsInteger ? '0' : '10%'};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing the styles here have had some unintended consequences in other places that we use the GuideTiles. I think moving these styles to the LabOverviewTemplate might be best. you can use the css prop within that guidetile just like here and select for the p and h3

normal styling:
Screen Shot 2022-02-04 at 9 15 26 AM

current changes:
Screen Shot 2022-02-04 at 9 15 34 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That spacing between the tiles seems really wide I'd recommend following the pattern we use for space between the quickstart tiles on I/O

https://developer.newrelic.com/instant-observability/
Screen Shot 2022-02-04 at 11 00 32 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totalny agree, I didn’t noticed that change will have so big impact on other views, i will move that styles to LabOverviewTemplate asap to keep website pattern, thank you for your advices

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kisielewskik!

border-radius: 0.25rem;
position: relative;
padding: 1rem;
Expand All @@ -22,7 +31,7 @@ const GuideTile = ({ duration, title, description, className, to }) => (
<h3
css={css`
font-size: 1rem;
margin-bottom: 0.5rem;
margin-bottom: ${procIdxIsInteger ? '1rem' : '0.1rem'};
`}
>
{title}
Expand All @@ -34,6 +43,7 @@ const GuideTile = ({ duration, title, description, className, to }) => (
flex: 1;
text-align: left;
padding: 0;
margin-bottom: ${procIdxIsInteger ? '0.8rem' : '0.1rem'};
`}
>
{description}
Expand Down Expand Up @@ -64,6 +74,7 @@ GuideTile.propTypes = {
description: PropTypes.string.isRequired,
className: PropTypes.string,
to: PropTypes.string.isRequired,
procIdxIsInteger: PropTypes.bool,
};

export default GuideTile;
38 changes: 23 additions & 15 deletions src/templates/LabOverviewTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,29 @@ const LabOverviewTemplate = ({ data, location }) => {
<GuideListing.List className={labOverviewStyles.labGuideList}>
{guides?.nodes
.sort(sortProcedures)
.map(({ fields, frontmatter }, index) => (
<GuideTile
className={labOverviewStyles.labGuideCard}
to={fields.slug}
key={index}
duration={frontmatter.duration}
title={`${frontmatter.procIdx}. ${
frontmatter.tileShorthand?.title || frontmatter.title
}`}
description={
frontmatter.tileShorthand?.description ||
frontmatter.description
}
/>
))}
.map(({ fields, frontmatter }, index) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attached is the screen shot for this change so it's visible, this is OK for me, so I approve this.
Screen Shot 2022-02-04 at 9 47 45 AM

const procIdxIsInteger = Number.isInteger(
frontmatter.procIdx
);
return (
<GuideTile
procIdxIsInteger={procIdxIsInteger}
className={labOverviewStyles.labGuideCard}
to={fields.slug}
key={index}
duration={frontmatter.duration}
title={`${
procIdxIsInteger ? `${frontmatter.procIdx}.` : ''
} ${
frontmatter.tileShorthand?.title || frontmatter.title
}`}
description={
frontmatter.tileShorthand?.description ||
frontmatter.description
}
/>
);
})}
</GuideListing.List>
</>
)}
Expand Down