Skip to content

Commit e335178

Browse files
authored
🚑 Fix broken links on usage and documentation page (#269)
1 parent 874a4af commit e335178

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

doc/src/components/WithComponentsBar/WithComponentBar.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import React from 'react';
55
import PropTypes from 'prop-types';
66
import { navigate } from 'gatsby';
7-
import { Link } from '@reach/router';
87
import { componentList } from '../common/componentList';
98
import Button from '../../../../lib/button';
109
import Drawer from '../../../../lib/drawer';
@@ -27,9 +26,9 @@ class WithComponentBar extends React.Component {
2726
}
2827
}
2928

30-
navigateToPlayground = () => {
29+
navigateToPage = (toPage) => {
3130
const { page, activeComponent } = this.props;
32-
navigate(`/playground?component=${activeComponent.toLowerCase()}`, { state: { prevPage: page } });
31+
navigate(`/${toPage}?component=${activeComponent.toLowerCase()}`, { state: { prevPage: page } });
3332
}
3433

3534
render() {
@@ -58,17 +57,14 @@ class WithComponentBar extends React.Component {
5857
<Button bordered>select component</Button>
5958
</span>
6059
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
61-
<Button onClick={this.navigateToPlayground} bordered type="primary">Open in playground</Button>
60+
<Button onClick={() => this.navigateToPage('playground')} bordered type="primary">Open in playground</Button>
6261
</div>
6362
{children}
6463
<div className="component-footer">
6564
<span className="sub-title">{toPage}</span>
66-
{/* eslint-disable-next-line */}
67-
<Link to={`/${toPage}?component=${activeComponent.toLowerCase()}`}>
68-
<div className="switch-page">
69-
{activeComponent}
70-
</div>
71-
</Link>
65+
<div className="switch-page" onClick={() => this.navigateToPage(toPage)}>
66+
{activeComponent}
67+
</div>
7268
</div>
7369
</div>
7470
</div>

doc/src/components/WithComponentsBar/styles.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@
8181
.component-footer {
8282
display: flex;
8383
flex-direction: column;
84-
a {
84+
.switch-page {
85+
cursor: pointer;
8586
width: fit-content;
8687
float: left;
8788
outline: none;
88-
}
89-
.switch-page {
9089
color: #5d50c6;
9190
padding: 0.8em;
9291
font-size: 1.2em;

0 commit comments

Comments
 (0)