Skip to content

Commit

Permalink
feat: added teh ability to specify icons to GuideTile
Browse files Browse the repository at this point in the history
  • Loading branch information
zstix committed Jun 19, 2020
1 parent 571aef6 commit fca1d49
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/GuideTile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import PropTypes from 'prop-types';
import React from 'react';
import FeatherIcon from './FeatherIcon';
import cx from 'classnames';
import { navigate } from 'gatsby';
import styles from './GuideTile.module.scss';

const GuideTile = ({ minutes, title, description, path, className }) => (
const GuideTile = ({ icon, minutes, title, description, path, className }) => (
<div className={cx(styles.tile, className)}>
{icon && (
<div className={styles.iconContainer}>
<FeatherIcon name={icon} size="2.5rem" />
</div>
)}

<div className={styles.timeEstimate}>{minutes} minutes</div>
<div className={styles.main}>
<h2>{title}</h2>
Expand All @@ -23,6 +30,7 @@ GuideTile.propTypes = {
description: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
className: PropTypes.string,
icon: PropTypes.string,
};

export default GuideTile;
16 changes: 16 additions & 0 deletions src/components/GuideTile.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
padding: 0.5rem;
border: 1px solid var(--color-neutrals-300);
border-radius: 0.25rem;
position: relative;

button:hover {
transform: translateY(-1px);
Expand All @@ -28,6 +29,21 @@
background-position: left center;
}

.iconContainer {
position: absolute;
top: -2.75rem;
left: 50%;
margin-left: -2.75rem;
width: 5.5rem;
height: 5.5rem;
border: 4px solid var(--color-white);
background-color: var(--color-neutrals-200);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}

.main {
grid-area: main;
display: flex;
Expand Down

0 comments on commit fca1d49

Please sign in to comment.