Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #78 from 30-seconds/breadcrumbs
Browse files Browse the repository at this point in the history
Introduce breadcrumbs
Resolves #24
  • Loading branch information
Chalarangelo authored Feb 24, 2020
2 parents c9ee786 + cb311f8 commit f5b6b2d
Show file tree
Hide file tree
Showing 29 changed files with 533 additions and 187 deletions.
1 change: 1 addition & 0 deletions src/atoms/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import './anchor';
@import './breadcrumbs';
@import './browserSupport';
@import './button';
@import './card';
Expand Down
26 changes: 24 additions & 2 deletions src/atoms/anchor/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
@import './regularAnchor';
@import './linkBackAnchor';
// Colors
:root {
--a-link-color: #0277bd;
--a-visited-color: #01579b;
}

// Dark mode colors
.page-container.dark {
--a-link-color: #6DC7FD;
--a-visited-color: #5DB7FE;
}

a {
text-decoration: none;
&:link{
color: var(--a-link-color);
}
&:visited {
color: var(--a-visited-color);
}
&:hover, &:focus {
text-decoration: underline;
}
}
53 changes: 48 additions & 5 deletions src/atoms/anchor/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,50 @@
import Anchor from './regularAnchor';
import LinkBackAnchor from './linkBackAnchor';
import React from 'react';
import { Link } from 'gatsby';
import PropTypes from 'prop-types';
import { Link as LinkPropType } from 'typedefs';
import { addTrailingSlashToSlug } from 'functions/utils';

export {
Anchor,
LinkBackAnchor,
/**
* Anchor component for linking to a different URL (internal or external).
* Depends on Gatsby's Link component for internal linking.
*/
const Anchor = ({
children,
link,
...rest
}) => {
return link.internal ?
(
<Link
to={ addTrailingSlashToSlug(link.url) }
rel={ link.rel }
target={ link.target }
{ ...rest }
>
{ children }
</Link>
) : (
<a
href={ link.url }
rel={ link.rel }
target={ link.target }
{ ...rest }
>
{ children }
</a>
);
};

Anchor.propTypes = {
/** Children elements */
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
/** Anchor link data */
link: LinkPropType.isRequired,
/** Any other props to be passed to the component */
rest: PropTypes.any,
};

export default Anchor;
40 changes: 0 additions & 40 deletions src/atoms/anchor/linkBackAnchor/index.jsx

This file was deleted.

36 changes: 0 additions & 36 deletions src/atoms/anchor/linkBackAnchor/linkBackAnchor.test.jsx

This file was deleted.

24 changes: 0 additions & 24 deletions src/atoms/anchor/regularAnchor/_index.scss

This file was deleted.

50 changes: 0 additions & 50 deletions src/atoms/anchor/regularAnchor/index.jsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,26 @@ a.link-back {
margin-right: 0.875rem;
}
}

a.link-back.has-more {
display: inline-block;
margin-right: 0;
margin-bottom: 0;
}

// Second link in breadcrumbs
a.link-back-more {
transition: 0.3s ease all;
font-size: 1.125rem;
line-height: 1.35;
display: inline-block;
margin: 0.8125rem 1.25rem 0 0;
position: relative;
&, &:link, &:visited {
color: var(--fore-color-dark);
}

@media screen and (max-width: calc(#{$layout-medium-breakpoint} - 1px)) {
margin-right: 0.875rem;
}
}
Loading

0 comments on commit f5b6b2d

Please sign in to comment.