Skip to content

Commit 2227567

Browse files
huv1ktimsuchanek
authored andcommitted
Ui fixes (#789)
* Update scrollbars: Fixes #710, Fixes #726, Fixes #690 * Scroll for execute options: Fixes #774 * Fix inconsistency: Fixes #343 * Fix scrolling in hints: Fixes #595 * Fix tabs scroll: Fixes #776
1 parent 4c22d5f commit 2227567

File tree

6 files changed

+80
-23
lines changed

6 files changed

+80
-23
lines changed

packages/graphql-playground-react/src/components/Playground/EditorWrapper.tsx

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ const EditorWrapper = styled.div`
269269
white-space: nowrap;
270270
}
271271
.CodeMirror-linenumbers {
272+
background: ${p => p.theme.editorColours.editorBackground};
272273
}
273274
.CodeMirror-linenumber {
274275
font-family: Open Sans, sans-serif;
@@ -347,12 +348,15 @@ const EditorWrapper = styled.div`
347348
height: 100%;
348349
/* 30px is the magic margin used to hide the element's real scrollbars */
349350
/* See overflow: hidden in .CodeMirror */
350-
margin-bottom: -30px;
351-
margin-right: -30px;
351+
/* margin-bottom: -30px;
352+
margin-right: -30px; */
352353
outline: none; /* Prevent dragging from highlighting the element */
353-
overflow: scroll !important; /* Things will break if this is overridden */
354-
padding-bottom: 30px;
354+
overflow: hidden;
355+
/* padding-bottom: 30px; */
355356
position: relative;
357+
&:hover {
358+
overflow: scroll !important; /* Things will break if this is overridden */
359+
}
356360
}
357361
.CodeMirror-sizer {
358362
border-right: 30px solid transparent;
@@ -630,6 +634,7 @@ const EditorWrapper = styled.div`
630634
}
631635
632636
.CodeMirror-jump-token {
637+
cursor: pointer;
633638
text-decoration: underline;
634639
}
635640
`
@@ -638,6 +643,33 @@ const EditorWrapper = styled.div`
638643
// .CodeMirror-info info for types breaks stack trace
639644
// tslint:disable-next-line
640645
injectGlobal`
646+
*::-webkit-scrollbar {
647+
-webkit-appearance: none;
648+
width: 7px;
649+
height: 7px;
650+
}
651+
*::-webkit-scrollbar-track-piece {
652+
background-color: rgba(255, 255, 255, 0);
653+
}
654+
*::-webkit-scrollbar-track {
655+
background-color: inherit;
656+
}
657+
*::-webkit-scrollbar-thumb {
658+
max-height: 100px;
659+
border-radius: 3px;
660+
background-color: rgba(1, 1, 1, 0.23);
661+
}
662+
*::-webkit-scrollbar-thumb:hover {
663+
background-color: rgba(1, 1, 1, 0.35);
664+
}
665+
*::-webkit-scrollbar-thumb:active {
666+
background-color: rgba(1, 1, 1, 0.48);
667+
}
668+
*::-webkit-scrollbar-corner {
669+
background: rgba(0,0,0,0);
670+
}
671+
672+
641673
.CodeMirror-lint-tooltip, .CodeMirror-info {
642674
background-color: white;
643675
border-radius: 4px 4px 4px 4px;
@@ -719,14 +751,16 @@ injectGlobal`
719751
margin-left: -6px;
720752
margin: 0;
721753
max-height: 20em;
722-
overflow-y: auto;
723754
overflow: hidden;
724755
padding: 0;
725756
position: absolute;
726757
z-index: 10;
727758
border-radius: 2px;
728759
top: 0 !important;
729760
left: 0 !important;
761+
&:hover {
762+
overflow-y: overlay;
763+
}
730764
}
731765
732766
.CodeMirror-hints-wrapper {
@@ -742,7 +776,7 @@ injectGlobal`
742776
box-shadow: none;
743777
margin-left: 0;
744778
position: relative;
745-
z-index: 0;
779+
z-index: 0;
746780
}
747781
748782
.CodeMirror-hint {

packages/graphql-playground-react/src/components/Playground/ExecuteButton.tsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,20 @@ class ExecuteButton extends React.Component<ReduxProps, State> {
5959
if (hasOptions && optionsOpen) {
6060
const highlight = this.state.highlight
6161
options = (
62-
<ExecuteOptions>
63-
{operations.map(operation => (
64-
<ExecuteButtonOperation
65-
operation={operation}
66-
onMouseOver={this.handleMouseOver}
67-
onMouseOut={this.handleMouseOut}
68-
onMouseUp={this.handleMouseUp}
69-
highlight={highlight}
70-
key={operation.name ? operation.name.value : '*'}
71-
/>
72-
))}
73-
</ExecuteOptions>
62+
<ExecuteBox>
63+
<ExecuteOptions>
64+
{operations.map(operation => (
65+
<ExecuteButtonOperation
66+
operation={operation}
67+
onMouseOver={this.handleMouseOver}
68+
onMouseOut={this.handleMouseOut}
69+
onMouseUp={this.handleMouseUp}
70+
highlight={highlight}
71+
key={operation.name ? operation.name.value : '*'}
72+
/>
73+
))}
74+
</ExecuteOptions>
75+
</ExecuteBox>
7476
)
7577
}
7678

@@ -231,12 +233,12 @@ const Button = withProps<ButtonProps>()(styled.div)`
231233
}
232234
`
233235

234-
const ExecuteOptions = styled.ul`
236+
const ExecuteBox = styled.div`
235237
background: #fff;
236238
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.25);
239+
padding: 8px 0;
237240
left: -1px;
238241
margin: 0;
239-
padding: 8px 0;
240242
position: absolute;
241243
top: 78px;
242244
z-index: 100;
@@ -251,6 +253,11 @@ const ExecuteOptions = styled.ul`
251253
width: 8px;
252254
height: 8px;
253255
}
256+
`
257+
258+
const ExecuteOptions = styled.ul`
259+
max-height: 270px;
260+
overflow: scroll;
254261
255262
li {
256263
cursor: pointer;

packages/graphql-playground-react/src/components/Playground/GraphQLEditor.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,9 @@ class GraphQLEditor extends React.PureComponent<
313313
isOpen={this.props.responseTracingOpen}
314314
onMouseDown={this.handleTracingResizeStart}
315315
>
316-
Tracing
316+
<VariableEditorSubtitle isOpen={false}>
317+
Tracing
318+
</VariableEditorSubtitle>
317319
</ResponseTrackingTitle>
318320
<ResponseTracing open={this.props.responseTracingOpen} />
319321
</ResponseTracking>
@@ -694,7 +696,7 @@ const BottomDrawerTitle = styled.div`
694696
letter-spacing: 0.53px;
695697
line-height: 14px;
696698
font-size: 14px;
697-
padding: 14px 14px 5px 21px;
699+
padding: 14px 14px 15px 21px;
698700
user-select: none;
699701
`
700702

@@ -704,6 +706,12 @@ const VariableEditor = styled(BottomDrawer)`
704706
width: calc(100% - 12px);
705707
background: ${p => p.theme.editorColours.leftDrawerBackground};
706708
}
709+
.CodeMirror-lines {
710+
padding: 10px 0 20px 0;
711+
}
712+
.CodeMirror-linenumbers {
713+
background: ${p => p.theme.editorColours.leftDrawerBackground};
714+
}
707715
`
708716

709717
const VariableEditorTitle = withProps<TitleProps>()(styled(BottomDrawerTitle))`
@@ -718,6 +726,9 @@ const VariableEditorSubtitle = withProps<TitleProps>()(styled.span)`
718726
p.isOpen
719727
? p.theme.editorColours.drawerText
720728
: p.theme.editorColours.drawerTextInactive};
729+
&:last-child {
730+
margin-right: 0;
731+
}
721732
`
722733

723734
const ResponseTracking = styled(BottomDrawer)`

packages/graphql-playground-react/src/components/Playground/ResponseTracing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface ReduxProps {
3737
}
3838

3939
const TracingWrapper = styled.div`
40-
padding-top: 16px;
40+
padding-top: 6px;
4141
padding-left: 25px;
4242
padding-right: 25px;
4343
color: ${p => p.theme.editorColours.text};

packages/graphql-playground-react/src/components/Playground/Tab.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ interface TabItemProps {
148148
}
149149

150150
const TabItem = withProps<TabItemProps>()(styled.div)`
151+
flex: 0 0 auto;
151152
display: flex;
152153
align-items: center;
153154
height: 43px;

packages/graphql-playground-react/src/components/Playground/TabBar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ const StyledTabBar = styled.div`
5959
color: white;
6060
height: 57px;
6161
background: ${p => p.theme.editorColours.background};
62+
overflow: hidden;
6263
-webkit-app-region: drag;
64+
&:hover {
65+
overflow-x: overlay;
66+
}
6367
`
6468

6569
interface TabsProps {

0 commit comments

Comments
 (0)