Skip to content

Commit

Permalink
feat: new styles for subtask in lab
Browse files Browse the repository at this point in the history
  • Loading branch information
kisielewskik committed Jan 25, 2022
1 parent 2d7a304 commit 5e89f3b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
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) => {
const procIdxisNotInteger = Number.isInteger(
frontmatter.procIdx
);
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

0 comments on commit 5e89f3b

Please sign in to comment.