Skip to content

Replace Blog link with Wiki link #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/components/Shared/TargetBlankLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ReactNode } from 'react';
import targetBlankSvg from './targetBlank.svg';

type TargetBlankLinkProps = {
href: string;
children: ReactNode;
};

export function TargetBlankLink({ href, children }: TargetBlankLinkProps) {
return (
<a href={href} target="_blank" rel="noopener noreferrer">
Copy link
Preview

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] For better accessibility, add an aria-label (e.g., aria-label="opens link in new tab") to the link to clearly indicate its behavior to screen readers.

Suggested change
<a href={href} target="_blank" rel="noopener noreferrer">
<a href={href} target="_blank" rel="noopener noreferrer" aria-label="opens link in new tab">

Copilot uses AI. Check for mistakes.

{children}
<img height={20} style={{ verticalAlign: 'text-bottom' }} src={targetBlankSvg} alt="Link opens in new tab" />
</a>
);
}
21 changes: 21 additions & 0 deletions src/components/Shared/targetBlank.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 6 additions & 9 deletions src/layouts/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { RouteComponentProps, withRouter } from 'react-router';
import Helmet from 'react-helmet';
import { getLocaleType, localeGet } from '../utils/LocaleUtils.ts';
import '../styles/app.scss';
import { TargetBlankLink } from '../components/Shared/TargetBlankLink.tsx';

const modules = ['guide', 'api', 'examples', 'blog', 'storybook'];
const modules = ['guide', 'api', 'examples', 'storybook'];

const locales = [
{ locale: 'en-US', text: 'En' },
Expand Down Expand Up @@ -66,15 +67,11 @@ class Frame extends Component<FrameProps> {
</Link>
</li>
))}
<li className="github-wiki">
<TargetBlankLink href="https://github.com/recharts/recharts/wiki">Wiki</TargetBlankLink>
</li>
<li className="github-wrapper">
<a
href="https://github.com/recharts/recharts"
target="_blank"
className="nav-github"
rel="noreferrer"
>
GitHub
</a>
<TargetBlankLink href="https://github.com/recharts/recharts">GitHub</TargetBlankLink>
</li>
<li className="language-switch-wrapper">{this.renderLocaleSwitch(locale)}</li>
</ul>
Expand Down
12 changes: 2 additions & 10 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Redirect, Route, Switch } from 'react-router-dom';
import { IndexView, GuideView, APIView, ExamplesView, BlogView, Storybook } from '../views';
import { IndexView, GuideView, APIView, ExamplesView, Storybook } from '../views';
import Frame from '../layouts/Frame';
import { defaultLocale } from '../utils/LocaleUtils.ts';

export type RouteParams = {
name?: string;
};

export default function () {
export default function routes() {
return (
<Switch>
<Route path="/" exact render={() => <Redirect to={`/${defaultLocale}`} />} />
Expand Down Expand Up @@ -35,14 +35,6 @@ export default function () {
</Frame>
)}
/>
<Route
path="/*/blog"
render={() => (
<Frame>
<BlogView />
</Frame>
)}
/>
<Route
path="/*/storybook"
render={() => (
Expand Down
63 changes: 0 additions & 63 deletions src/views/BlogView.js

This file was deleted.

24 changes: 0 additions & 24 deletions src/views/BlogView.scss

This file was deleted.

4 changes: 2 additions & 2 deletions src/views/Storybook.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { PureComponent } from 'react';
import './Storybook.scss';
import './iframe.scss';

class Storybook extends PureComponent {
render() {
return (
<iframe
title="Recharts storybook"
className="storybook"
className="fullscreen"
src="https://main--63da8268a0da9970db6992aa.chromatic.com/"
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/views/Storybook.scss → src/views/iframe.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
iframe.storybook {
iframe.fullscreen {
width: 100%;
Copy link
Preview

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The .fullscreen class and iframe.scss filename are generic; consider using a more specific naming (e.g., .storybook-fullscreen, storybook-iframe.scss) to avoid naming conflicts.

Suggested change
iframe.fullscreen {
iframe.storybook-fullscreen {

Copilot uses AI. Check for mistakes.

height: calc(100vh - 150px);
border: 0;
Expand Down
3 changes: 1 addition & 2 deletions src/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import IndexView from './IndexView';
import GuideView from './GuideView';
import APIView from './APIView';
import ExamplesView from './ExamplesView';
import BlogView from './BlogView';
import Storybook from './Storybook';

export { IndexView, GuideView, APIView, ExamplesView, BlogView, Storybook };
export { IndexView, GuideView, APIView, ExamplesView, Storybook };
Loading