Skip to content

Commit 4b5b75f

Browse files
authored
Merge branch 'master' into feedback-on-reload-schema
2 parents 000946f + 640a492 commit 4b5b75f

File tree

1 file changed

+60
-22
lines changed
  • packages/graphql-playground-react/src/components/Playground/TopBar

1 file changed

+60
-22
lines changed

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

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import * as CopyToClipboard from 'react-copy-to-clipboard'
66
import Share, { SharingProps } from '../../Share'
77
import ReloadIcon from './ReloadIcon'
88
import { StyledComponentClass } from 'styled-components'
9+
import { keyframes, StyledComponentClass } from 'styled-components'
10+
import { Icon } from 'graphcool-styles'
911
import * as cx from 'classnames'
1012

1113
export interface Props {
@@ -104,6 +106,11 @@ const barBorder = theme('mode', {
104106
dark: p => '#09141c',
105107
})
106108

109+
const spinnerColor = theme('mode', {
110+
light: p => p.theme.colours.black40,
111+
dark: p => p.theme.colours.white30,
112+
})
113+
107114
export const Button: StyledComponentClass<any, any, any> = styled.button`
108115
text-transform: uppercase;
109116
font-weight: 600;
@@ -127,8 +134,7 @@ export const Button: StyledComponentClass<any, any, any> = styled.button`
127134
const TopBarWrapper = styled.div`
128135
display: flex;
129136
background: ${backgroundColor};
130-
padding: 10px;
131-
padding-bottom: 4px;
137+
padding: 10px 10px 4px;
132138
align-items: center;
133139
`
134140

@@ -161,6 +167,7 @@ const ReachError = styled.div`
161167
color: #f25c54;
162168
`
163169

170+
164171
const Spinner = styled.div`
165172
& {
166173
width: 40px;
@@ -170,29 +177,60 @@ const Spinner = styled.div`
170177
border-radius: 100%;
171178
-webkit-animation: sk-pulseScaleOut 1s infinite ease-in-out;
172179
animation: sk-pulseScaleOut 1s infinite ease-in-out;
173-
}
180+
`
174181

175-
@-webkit-keyframes sk-pulseScaleOut {
176-
0% {
177-
-webkit-transform: scale(0);
178-
transform: scale(0);
179-
}
180-
100% {
181-
-webkit-transform: scale(1);
182-
transform: scale(1);
183-
opacity: 0;
182+
const ReloadIcon = styled(Icon)`
183+
position: absolute;
184+
right: 5px;
185+
cursor: pointer;
186+
svg {
187+
fill: ${iconColor};
188+
transition: 0.1s linear all;
189+
&:hover {
190+
fill: ${iconColorHover};
184191
}
185192
}
193+
` as any // TODO remove this once typings are fixed
186194

187-
@keyframes sk-pulseScaleOut {
188-
0% {
189-
-webkit-transform: scale(0);
190-
transform: scale(0);
191-
}
192-
100% {
193-
-webkit-transform: scale(1);
194-
transform: scale(1);
195-
opacity: 0;
196-
}
195+
const bounceAnimation = keyframes`
196+
0%, 100% {
197+
transform: scale(0);
198+
}
199+
50% {
200+
transform: scale(1);
197201
}
198202
`
203+
204+
const Pulse = styled.div`
205+
width: 16px;
206+
height: 16px;
207+
background-color: ${spinnerColor};
208+
border-radius: 100%;
209+
animation: ${bounceAnimation} 2s infinite ease-in-out;
210+
-webkit-animation: ${bounceAnimation} 2s infinite ease-in-out;
211+
`
212+
213+
const DelayedPulse = styled.div`
214+
width: 16px;
215+
height: 16px;
216+
position: absolute;
217+
top: 0;
218+
background-color: ${spinnerColor};
219+
border-radius: 100%;
220+
animation: ${bounceAnimation} 2s infinite ease-in-out;
221+
-webkit-animation: ${bounceAnimation} 2s infinite ease-in-out;
222+
animation-delay: -1s;
223+
-webkit-animation-delay: -1.0s;
224+
`
225+
226+
const SpinnerWrapper = styled.div`
227+
position: relative;
228+
margin: 6px;
229+
`
230+
231+
const Spinner = () => (
232+
<SpinnerWrapper>
233+
<Pulse />
234+
<DelayedPulse />
235+
</SpinnerWrapper>
236+
)

0 commit comments

Comments
 (0)