Skip to content

Commit

Permalink
fix(gatsby-deployment): change all href to Link
Browse files Browse the repository at this point in the history
issue #51
  • Loading branch information
sabertazimi committed Mar 6, 2019
1 parent f111f3c commit 9361ecb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
7 changes: 4 additions & 3 deletions gatsby/src/components/ArticleHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { Link } from 'gatsby';
import { Header, Label } from 'semantic-ui-react';
import { PRIMARY_COLOR } from '../constants';

Expand All @@ -10,8 +11,8 @@ const ArticleHeader = ({ color, post }) => (
return (
<Label
key={index}
as="a"
href={`/tags/${tag}`}
as={Link}
to={`/tags/${tag}`}
color={PRIMARY_COLOR}
tag
>
Expand All @@ -20,7 +21,7 @@ const ArticleHeader = ({ color, post }) => (
);
})
) : (
<Label as="a" href="/tags/all" color={PRIMARY_COLOR} tag>
<Label as={Link} to="/tags/all" color={PRIMARY_COLOR} tag>
CS
</Label>
)}
Expand Down
7 changes: 3 additions & 4 deletions gatsby/src/components/BookCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ const BookCard = ({
author,
description,
}) => (
<Card>
<Card.Content>
<Card fluid raised>
<Card.Content textAlign="center">
<Card.Header>
<a href={url}>
<Icon name='book' />
{ title }
<h3>{ title }</h3>
</a>
</Card.Header>
<Card.Meta>
Expand Down
5 changes: 3 additions & 2 deletions gatsby/src/components/PostPreview.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import { Link } from 'gatsby';
import { Container, Label } from 'semantic-ui-react';
import PreviewMarkdown from './PreviewMarkdown';
import './PostPreview.css';
Expand Down Expand Up @@ -52,9 +53,9 @@ class PostPreview extends Component {
className="cell"
>
<Label
as="a"
as={Link}
color={this.getRandomColor()}
href={`/tags/${tagName}`}
to={`/tags/${tagName}`}
ribbon
>
{tagName}
Expand Down
27 changes: 15 additions & 12 deletions gatsby/src/components/PreviewMarkdown.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Container, Dimmer, Icon, Button, Label } from 'semantic-ui-react';
import { Link } from 'gatsby';
import { Container, Dimmer, Icon, Button } from 'semantic-ui-react';

import { PRIMARY_COLOR } from '../constants';

Expand All @@ -16,24 +17,26 @@ const PreviewMarkdown = ({
style={{ marginTop: '-1em', marginBottom: '3em' }}
>
<Dimmer active={dimmerActive}>
<Label
as="a"
<Button
as={Link}
style={{
position: 'absolute',
top: '50%',
left: '50%',
padding: 0,
margin: 0,
transform: 'translate(-50%, -50%)',
}}
href={`${post.slug}`}
animated="fade"
inverted
color={PRIMARY_COLOR}
size="large"
to={`${post.slug}`}
>
<Button style={{ margin: 0 }} animated="fade" color={PRIMARY_COLOR} size="large">
<Button.Content visible>Read More</Button.Content>
<Button.Content hidden>
<Icon inverted name="right arrow" />
</Button.Content>
</Button>
</Label>
<Button.Content visible>Read More</Button.Content>
<Button.Content hidden>
<Icon inverted name="right arrow" />
</Button.Content>
</Button>
</Dimmer>
<Container style={{ opacity: '0.5' }}>
<div>{post.excerpt}</div>
Expand Down
12 changes: 8 additions & 4 deletions gatsby/src/components/ScrollToTopButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ const ScrollToTopButton = () => {
if (element) {
element.scrollIntoView({
behavior: 'smooth',
blcok: 'start'
blcok: 'start',
});
}
};

return (
<div>
<Button
style={{ width: '100px' }}
animated="fade"
color={PRIMARY_COLOR}
inverted
Expand All @@ -40,14 +41,15 @@ const ScrollToTopButton = () => {
direction="up"
onClick={scrollTo}
>
<Button.Content visible>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Top&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<Button.Content visible textAlign="center">
Top
</Button.Content>
<Button.Content hidden>
<Icon name="up arrow" />
</Button.Content>
</Button>
<Button
style={{ width: '100px' }}
animated="fade"
color={PRIMARY_COLOR}
inverted
Expand All @@ -56,7 +58,9 @@ const ScrollToTopButton = () => {
direction="down"
onClick={scrollTo}
>
<Button.Content visible>Bottom</Button.Content>
<Button.Content visible textAlign="center">
Bottom
</Button.Content>
<Button.Content hidden>
<Icon name="down arrow" />
</Button.Content>
Expand Down

0 comments on commit 9361ecb

Please sign in to comment.