Skip to content

Commit 8cbc3e3

Browse files
authored
Replace Blog link with Wiki link (#329)
1 parent 1f7ba2c commit 8cbc3e3

File tree

9 files changed

+49
-111
lines changed

9 files changed

+49
-111
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { ReactNode } from 'react';
2+
import targetBlankSvg from './targetBlank.svg';
3+
4+
type TargetBlankLinkProps = {
5+
href: string;
6+
children: ReactNode;
7+
};
8+
9+
export function TargetBlankLink({ href, children }: TargetBlankLinkProps) {
10+
return (
11+
<a href={href} target="_blank" rel="noopener noreferrer">
12+
{children}
13+
<img height={20} style={{ verticalAlign: 'text-bottom' }} src={targetBlankSvg} alt="Link opens in new tab" />
14+
</a>
15+
);
16+
}

src/components/Shared/targetBlank.svg

Lines changed: 21 additions & 0 deletions
Loading

src/layouts/Frame.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import { RouteComponentProps, withRouter } from 'react-router';
44
import Helmet from 'react-helmet';
55
import { getLocaleType, localeGet } from '../utils/LocaleUtils.ts';
66
import '../styles/app.scss';
7+
import { TargetBlankLink } from '../components/Shared/TargetBlankLink.tsx';
78

8-
const modules = ['guide', 'api', 'examples', 'blog', 'storybook'];
9+
const modules = ['guide', 'api', 'examples', 'storybook'];
910

1011
const locales = [
1112
{ locale: 'en-US', text: 'En' },
@@ -68,15 +69,11 @@ class Frame extends Component<FrameProps> {
6869
</Link>
6970
</li>
7071
))}
72+
<li className="github-wiki">
73+
<TargetBlankLink href="https://github.com/recharts/recharts/wiki">Wiki</TargetBlankLink>
74+
</li>
7175
<li className="github-wrapper">
72-
<a
73-
href="https://github.com/recharts/recharts"
74-
target="_blank"
75-
className="nav-github"
76-
rel="noreferrer"
77-
>
78-
GitHub
79-
</a>
76+
<TargetBlankLink href="https://github.com/recharts/recharts">GitHub</TargetBlankLink>
8077
</li>
8178
<li className="language-switch-wrapper">{this.renderLocaleSwitch(locale)}</li>
8279
</ul>

src/routes/index.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Redirect, Route, Switch } from 'react-router-dom';
2-
import { IndexView, GuideView, APIView, ExamplesView, BlogView, Storybook } from '../views';
2+
import { IndexView, GuideView, APIView, ExamplesView, Storybook } from '../views';
33
import Frame from '../layouts/Frame';
44
import { defaultLocale } from '../utils/LocaleUtils.ts';
55

66
export type RouteParams = {
77
name?: string;
88
};
99

10-
export default function () {
10+
export default function routes() {
1111
return (
1212
<Switch>
1313
<Route path="/" exact render={() => <Redirect to={`/${defaultLocale}`} />} />
@@ -35,14 +35,6 @@ export default function () {
3535
</Frame>
3636
)}
3737
/>
38-
<Route
39-
path="/*/blog"
40-
render={() => (
41-
<Frame>
42-
<BlogView />
43-
</Frame>
44-
)}
45-
/>
4638
<Route
4739
path="/*/storybook"
4840
render={() => (

src/views/BlogView.js

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/views/BlogView.scss

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/views/Storybook.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { PureComponent } from 'react';
2-
import './Storybook.scss';
2+
import './iframe.scss';
33

44
class Storybook extends PureComponent {
55
render() {
66
return (
77
<iframe
88
title="Recharts storybook"
9-
className="storybook"
9+
className="fullscreen"
1010
src="https://main--63da8268a0da9970db6992aa.chromatic.com/"
1111
/>
1212
);

src/views/Storybook.scss renamed to src/views/iframe.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
iframe.storybook {
1+
iframe.fullscreen {
22
width: 100%;
33
height: calc(100vh - 150px);
44
border: 0;

src/views/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import IndexView from './IndexView';
22
import GuideView from './GuideView';
33
import APIView from './APIView';
44
import ExamplesView from './ExamplesView';
5-
import BlogView from './BlogView';
65
import Storybook from './Storybook';
76

8-
export { IndexView, GuideView, APIView, ExamplesView, BlogView, Storybook };
7+
export { IndexView, GuideView, APIView, ExamplesView, Storybook };

0 commit comments

Comments
 (0)