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 1 commit
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,
procIdxisNotInteger,
}) => (
<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: ${procIdxisNotInteger ? '100%' : '90%'};
margin-left: ${procIdxisNotInteger ? '0' : '10%'};
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: ${procIdxisNotInteger ? '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: ${procIdxisNotInteger ? '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,
procIdxisNotInteger: 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 procIdxisNotInteger = Number.isInteger(
frontmatter.procIdx
);
Copy link
Contributor

Choose a reason for hiding this comment

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

as this is set up now procIdxisNotInteger will evaluate to true when a number is an integer. would you mind renaming it to procIdxIsInteger?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed name of variable is more logic now

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