Skip to content

Commit ff322c4

Browse files
committed
refactor: simplify button code by removing editor-button class
1 parent 4982249 commit ff322c4

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

src/components/app.css

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ html {
9898
display: none;
9999
}
100100

101-
button,
102-
.editor-button {
103-
cursor: pointer;
101+
button {
104102
padding: 0.3em 1em;
105103
border-style: solid;
106104
border-width: 1px;
@@ -113,34 +111,24 @@ button,
113111
justify-content: center;
114112
align-items: center;
115113
font-size: 0.9em;
116-
}
117-
118-
.editor-button {
119-
user-select: none;
120-
margin-right: 8px;
114+
cursor: pointer;
121115
}
122116

123117
button:hover,
124-
.editor-button:hover,
125-
button:focus,
126-
.editor-button:focus {
118+
button:focus {
127119
border-color: hsl(0, 0%, 70%);
128120
}
129121

130-
.editor-button:focus {
131-
outline: 0;
132-
}
133-
134-
button:active,
135-
.editor-button:active {
122+
button:active {
136123
border-color: hsl(0, 0%, 40%);
137124
}
138125

139-
button:disabled,
140-
.editor-button:disabled {
126+
button:disabled {
141127
opacity: 0.7;
142128
background-color: var(--light-gray-color);
143129
color: var(--extra-dark-gray-color);
130+
cursor: default;
131+
border-color: hsl(0, 0%, 80%);
144132
}
145133

146134
/* Scrollbar Styles */

src/components/header/share-modal/index.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
padding: 2em 0;
55
}
66

7-
.sharing-buttons .editor-button svg {
7+
.sharing-buttons button svg {
88
width: 22px;
99
height: 22px;
1010
stroke: var(--black-color);
1111
padding-right: 5px;
1212
}
1313

14+
.sharing-buttons button {
15+
margin-right: 8px;
16+
}
17+
1418
.user-pref {
1519
display: flex;
1620
align-items: center;

src/components/header/share-modal/renderer.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,20 +259,20 @@ class ShareModal extends React.PureComponent<Props, State> {
259259
</label>
260260
</div>
261261
<div className="sharing-buttons">
262-
<button className="editor-button" onClick={() => this.previewURL()}>
262+
<button onClick={() => this.previewURL()}>
263263
<Link />
264264
<span>Open Link</span>
265265
</button>
266266
<Clipboard
267-
className="editor-button copy-icon"
267+
className="copy-icon"
268268
data-clipboard-text={this.state.generatedURL}
269269
onSuccess={this.onCopy.bind(this)}
270270
>
271271
<Copy />
272272
<span>Copy Link to Clipboard</span>
273273
</Clipboard>
274274
<Clipboard
275-
className="editor-button copy-icon"
275+
className="copy-icon"
276276
data-clipboard-text={`[Open the Chart in the Vega Editor](${this.state.generatedURL})`}
277277
onSuccess={this.onCopy.bind(this)}
278278
>
@@ -330,15 +330,14 @@ class ShareModal extends React.PureComponent<Props, State> {
330330
)}
331331
<div className="sharing-buttons">
332332
<button
333-
className="editor-button"
334333
onClick={this.updateGist.bind(this)}
335334
disabled={!this.state.gistFileNameSelected || this.state.updating}
336335
>
337336
<Save />
338337
{this.state.updating ? 'Updating...' : 'Update'}
339338
</button>
340339
{this.state.gistEditorURL && this.state.updating !== undefined && (
341-
<Clipboard className="editor-button copy-icon" data-clipboard-text={this.state.gistEditorURL}>
340+
<Clipboard className="copy-icon" data-clipboard-text={this.state.gistEditorURL}>
342341
<Copy />
343342
<span>Copy Link to Clipboard</span>
344343
</Clipboard>
@@ -389,12 +388,12 @@ class ShareModal extends React.PureComponent<Props, State> {
389388
</label>
390389
</div>
391390
<div className="sharing-buttons">
392-
<button className="editor-button" onClick={this.createGist.bind(this)} disabled={this.state.creating}>
391+
<button onClick={this.createGist.bind(this)} disabled={this.state.creating}>
393392
<Save />
394393
{this.state.creating ? 'Creating...' : 'Create'}
395394
</button>
396395
{this.state.gistEditorURL && this.state.creating !== undefined && (
397-
<Clipboard className="editor-button copy-icon" data-clipboard-text={this.state.gistEditorURL}>
396+
<Clipboard className="copy-icon" data-clipboard-text={this.state.gistEditorURL}>
398397
<Copy />
399398
<span>Copy Link to Clipboard</span>
400399
</Clipboard>

0 commit comments

Comments
 (0)