Skip to content

Commit 83b79e3

Browse files
v6: Restyle the top bar Run button (play icon, divider, chip shortcut) (#4399)
## Summary Reworks the green **"Run"** button in the top bar (`.graphiql-top-bar-run`) so it stops reading as a heavy, cluttered element in an otherwise monochrome bar. - Add a small play icon before the "Run" label. - Add a faint vertical divider between the label and the keyboard shortcut. - Recolor the shortcut keys (`⌘` `⏎`) into translucent-white chips that sit on the green fill, instead of the default dark-bordered keycap boxes that looked like foreign objects on the button. - Set the label to medium weight (500) rather than the previous heavy bold (600). Also removes the hardcoded `font-weight: 600` from the shared primary button variant (`.graphiql-button-primary`), used by the collections plugin dialogs (Import / Export / Save), so its label matches the other buttons. ## Test plan - [ ] Open GraphiQL and look at the top bar "Run" button: play icon + "Run" + a faint divider + the `⌘⏎` shortcut as subtle chips. It should read as one calm unit, not stand out as bold/busy. - [ ] The shortcut chips should be legible white-on-green, not dark boxes. - [x] Open a collections dialog (e.g. Save / Import) and confirm the green primary button's label matches a neutral button's weight. - [x] Disabled state (e.g. GET selected with a mutation) still dims the whole button and shows the "switch to POST" tooltip. Refs: #4219
1 parent a8254bc commit 83b79e3

4 files changed

Lines changed: 32 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphiql/react': patch
3+
---
4+
5+
Refresh the top bar's "Run" button: add a play icon before the label, a faint divider before the keyboard shortcut, and recolor the shortcut keys into translucent chips that sit on the green fill instead of dark boxes. The label now uses medium weight rather than the heavier bold. Also remove the hardcoded bold weight from the primary button variant (used by the collections dialogs) so its label matches the other buttons.

packages/graphiql-react/src/components/button/index.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ button.graphiql-button {
4141
background-color: oklch(var(--btn-primary));
4242
border-color: oklch(var(--btn-primary-border));
4343
color: #fff;
44-
font-weight: 600;
4544

4645
&:hover {
4746
background-color: oklch(var(--btn-primary-border));

packages/graphiql-react/src/components/top-bar/index.css

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,34 @@
140140
color: #fff;
141141
font-family: var(--font-family);
142142
font-size: var(--font-size-body);
143-
font-weight: 600;
143+
font-weight: var(--font-weight-medium);
144144
cursor: pointer;
145145
white-space: nowrap;
146146
flex-shrink: 0;
147147
}
148148

149+
.graphiql-top-bar-run-icon {
150+
width: auto;
151+
height: 11px;
152+
flex-shrink: 0;
153+
}
154+
155+
.graphiql-top-bar-run-sep {
156+
width: 1px;
157+
height: 14px;
158+
background: rgb(255 255 255 / 0.28);
159+
flex-shrink: 0;
160+
}
161+
162+
/* The shortcut keys sit on the green fill here, not the dark bar. Darken them
163+
into subtle inset chips rather than the default dark boxes; a light (white)
164+
overlay would lighten the green and drop the white glyphs below AA contrast. */
165+
.graphiql-top-bar-run .graphiql-keycap {
166+
border-color: rgb(255 255 255 / 0.2);
167+
background: rgb(0 0 0 / 0.18);
168+
color: #fff;
169+
}
170+
149171
.graphiql-top-bar-run:disabled {
150172
opacity: 0.6;
151173
cursor: not-allowed;

packages/graphiql-react/src/components/top-bar/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { HttpMethod } from '@graphiql/toolkit';
77
import { useGraphiQL, useGraphiQLActions } from '../provider';
88
import { KeycapHint, MODIFIER } from '../keycap-hint';
99
import { Tooltip } from '../tooltip';
10-
import { GraphQLLogoIcon } from '../../icons';
10+
import { GraphQLLogoIcon, PlayIcon } from '../../icons';
1111
import { cn, getRunBlockReason, resolveActiveOperation } from '../../utility';
1212
import './index.css';
1313

@@ -88,7 +88,9 @@ export const TopBarView: FC<TopBarViewProps> = ({
8888
disabled={isFetching || isBlocked}
8989
aria-label="Run query"
9090
>
91-
Run
91+
<PlayIcon className="graphiql-top-bar-run-icon" aria-hidden="true" />
92+
<span className="graphiql-top-bar-run-label">Run</span>
93+
<span className="graphiql-top-bar-run-sep" aria-hidden="true" />
9294
<KeycapHint
9395
keys={[MODIFIER.Meta, MODIFIER.Enter]}
9496
ariaLabel="Run query shortcut"

0 commit comments

Comments
 (0)