Skip to content

Commit 95b0295

Browse files
committed
feat(editor): replace component Link with local LinkHome
* removes component dependency from swagger-ui for testing purposes * simplified home logo link * disabled accessibility warnings (for now)
1 parent 063e7f7 commit 95b0295

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

src/plugins/standalone/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import TopbarPlugin from '../topbar';
55
// import TopbarInsertPlugin from './topbar-insert';
6+
import LinkHome from '../topbar/components/LinkHome';
67
import DropdownMenu from '../topbar/components/DropdownMenu';
78
import DropdownItem from '../topbar/components/DropdownItem';
89
import FileMenuDropdown from '../topbar/components/FileMenuDropdown';
@@ -14,6 +15,7 @@ const StandalonePlugin = () => {
1415
return {
1516
components: {
1617
StandaloneLayout,
18+
LinkHome,
1719
DropdownMenu,
1820
DropdownItem,
1921
FileMenuDropdown,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* eslint-disable jsx-a11y/anchor-is-valid */
2+
/* eslint-disable jsx-a11y/anchor-has-content */
3+
import React, { PureComponent } from 'react';
4+
5+
import Logo from '../assets/logo_small.svg';
6+
7+
export default class LinkHome extends PureComponent {
8+
render() {
9+
return (
10+
<div>
11+
<a href="/" rel="noopener noreferrer" className="link">
12+
<img height="35" className="topbar-logo__img" src={Logo} alt="" />
13+
</a>
14+
</div>
15+
);
16+
}
17+
}

src/plugins/topbar/components/Topbar.jsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
import React, { Component } from 'react';
77
import PropTypes from 'prop-types';
88

9-
import Logo from '../assets/logo_small.svg';
10-
// import FileMenuDropdown from './topbar-file-menu'; // this works to, but then not available as getComponent
11-
// import DropdownMenu from './topbar-dropdown/DropdownMenu'; // this works to, but then not available as getComponent
12-
// import DropdownMenuItem from './topbar-dropdown/DropdownMenuItem'; // this works to, but then not available as getComponent
13-
149
export default class Topbar extends Component {
1510
constructor(props, context) {
1611
super(props, context);
@@ -98,8 +93,8 @@ export default class Topbar extends Component {
9893
render() {
9994
const { servers, clients } = this.state;
10095
const { getComponent, topbarActions } = this.props;
101-
// Link (to swagger) | each top-level DropdownMenu
102-
const Link = getComponent('Link'); // via swagger-ui
96+
97+
const LinkHome = getComponent('LinkHome');
10398
const DropdownMenu = getComponent('DropdownMenu');
10499
const DropdownItem = getComponent('DropdownItem');
105100
const FileMenuDropdown = getComponent('FileMenuDropdown');
@@ -109,9 +104,7 @@ export default class Topbar extends Component {
109104
<div className="swagger-editor-standalone">
110105
<div className="topbar">
111106
<div className="topbar-wrapper">
112-
<Link href="/">
113-
<img height="35" className="topbar-logo__img" src={Logo} alt="" />
114-
</Link>
107+
<LinkHome />
115108
<FileMenuDropdown getComponent={getComponent} topbarActions={topbarActions} />
116109
<EditMenuDropdown getComponent={getComponent} topbarActions={topbarActions} />
117110
<DropdownMenu displayName="Generate Server">

0 commit comments

Comments
 (0)