Skip to content

Commit 297af86

Browse files
committed
Drop 'classname' dependency
1 parent 93c0a37 commit 297af86

File tree

3 files changed

+13
-33
lines changed

3 files changed

+13
-33
lines changed

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
"@types/react-dom": "16.9.8",
5959
"@typescript-eslint/eslint-plugin": "5.59.5",
6060
"@typescript-eslint/parser": "5.59.5",
61-
"classnames": "2.3.1",
6261
"codemirror": "5.60.0",
6362
"codemirror-graphql": "0.11.6",
6463
"cspell": "6.31.1",

src/editor/index.tsx

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import './GraphQLEditor/editor.css';
44
import 'graphiql/graphiql.css';
55
import 'graphql-voyager/dist/voyager.css';
66

7-
import classNames from 'classnames';
87
import GraphiQL from 'graphiql';
98
import { GraphQLSchema, Source } from 'graphql';
109
import { Voyager } from 'graphql-voyager';
@@ -191,30 +190,27 @@ class FakeEditor extends React.Component<any, FakeEditorState> {
191190
<ul>
192191
<li
193192
onClick={() => this.switchTab(0)}
194-
className={classNames({
195-
'-active': activeTab === 0,
196-
'-unsaved': hasUnsavedChanges,
197-
})}
193+
className={`${activeTab === 0 ? '-active' : ''} ${
194+
hasUnsavedChanges ? '-unsaved' : ''
195+
}`}
198196
>
199197
{' '}
200198
<EditIcon />{' '}
201199
</li>
202200
<li
203201
onClick={() => !hasUnsavedChanges && this.switchTab(1)}
204-
className={classNames({
205-
'-disabled': hasUnsavedChanges,
206-
'-active': activeTab === 1,
207-
})}
202+
className={`${activeTab === 1 ? '-active' : ''} ${
203+
hasUnsavedChanges ? '-unsaved' : ''
204+
}`}
208205
>
209206
{' '}
210207
<ConsoleIcon />{' '}
211208
</li>
212209
<li
213210
onClick={() => !hasUnsavedChanges && this.switchTab(2)}
214-
className={classNames({
215-
'-disabled': hasUnsavedChanges,
216-
'-active': activeTab === 2,
217-
})}
211+
className={`${activeTab === 2 ? '-active' : ''} ${
212+
hasUnsavedChanges ? '-unsaved' : ''
213+
}`}
218214
>
219215
{' '}
220216
<VoyagerIcon />{' '}
@@ -232,11 +228,7 @@ class FakeEditor extends React.Component<any, FakeEditorState> {
232228
</ul>
233229
</nav>
234230
<div className="tabs-container">
235-
<div
236-
className={classNames('tab-content', 'editor-container', {
237-
'-active': activeTab === 0,
238-
})}
239-
>
231+
<div className={`tab-content editor-container ${activeTab === 0 ? '-active' : ''}`}>
240232
<GraphQLEditor
241233
schema={unsavedSchema || schema}
242234
onEdit={this.onEdit}
@@ -245,9 +237,7 @@ class FakeEditor extends React.Component<any, FakeEditorState> {
245237
/>
246238
<div className="action-panel">
247239
<a
248-
className={classNames('material-button', {
249-
'-disabled': !hasUnsavedChanges,
250-
})}
240+
className={`material-button ${hasUnsavedChanges ? '' : '-disabled'}`}
251241
onClick={this.saveUserSDL}
252242
>
253243
<span> Save </span>
@@ -258,18 +248,10 @@ class FakeEditor extends React.Component<any, FakeEditorState> {
258248
</div>
259249
</div>
260250
</div>
261-
<div
262-
className={classNames('tab-content', {
263-
'-active': activeTab === 1,
264-
})}
265-
>
251+
<div className={`tab-content ${activeTab === 1 ? '-active' : ''}`}>
266252
<GraphiQL fetcher={(e) => this.graphQLFetcher(e)} schema={schema} />
267253
</div>
268-
<div
269-
className={classNames('tab-content', {
270-
'-active': activeTab === 2,
271-
})}
272-
>
254+
<div className={'tab-content ' + (activeTab === 2 ? '-active' : '')}>
273255
<Voyager
274256
introspection={(e) => this.graphQLFetcher({ query: e })}
275257
hideSettings={activeTab !== 2}

0 commit comments

Comments
 (0)