Skip to content

Commit 640a492

Browse files
Weakkytimsuchanek
authored andcommitted
Fixed unreachable endpoint spinner size (#504)
* Fixed unreachable endpoint spinner size * Changed 'unreachable endpoint' spinner animation and color
1 parent ec6084b commit 640a492

File tree

1 file changed

+45
-34
lines changed
  • packages/graphql-playground-react/src/components/Playground/TopBar

1 file changed

+45
-34
lines changed

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

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as theme from 'styled-theming'
44
import { darken, lighten } from 'polished'
55
import * as CopyToClipboard from 'react-copy-to-clipboard'
66
import Share, { SharingProps } from '../../Share'
7-
import { StyledComponentClass } from 'styled-components'
7+
import { keyframes, StyledComponentClass } from 'styled-components'
88
import { Icon } from 'graphcool-styles'
99
import * as cx from 'classnames'
1010

@@ -115,6 +115,11 @@ const barBorder = theme('mode', {
115115
dark: p => '#09141c',
116116
})
117117

118+
const spinnerColor = theme('mode', {
119+
light: p => p.theme.colours.black40,
120+
dark: p => p.theme.colours.white30,
121+
})
122+
118123
export const Button: StyledComponentClass<any, any, any> = styled.button`
119124
text-transform: uppercase;
120125
font-weight: 600;
@@ -138,8 +143,7 @@ export const Button: StyledComponentClass<any, any, any> = styled.button`
138143
const TopBarWrapper = styled.div`
139144
display: flex;
140145
background: ${backgroundColor};
141-
padding: 10px;
142-
padding-bottom: 4px;
146+
padding: 10px 10px 4px;
143147
align-items: center;
144148
`
145149

@@ -185,38 +189,45 @@ const ReloadIcon = styled(Icon)`
185189
}
186190
` as any // TODO remove this once typings are fixed
187191

188-
const Spinner = styled.div`
189-
& {
190-
width: 40px;
191-
height: 40px;
192-
margin: 40px auto;
193-
background-color: #333;
194-
border-radius: 100%;
195-
-webkit-animation: sk-pulseScaleOut 1s infinite ease-in-out;
196-
animation: sk-pulseScaleOut 1s infinite ease-in-out;
192+
const bounceAnimation = keyframes`
193+
0%, 100% {
194+
transform: scale(0);
197195
}
198-
199-
@-webkit-keyframes sk-pulseScaleOut {
200-
0% {
201-
-webkit-transform: scale(0);
202-
transform: scale(0);
203-
}
204-
100% {
205-
-webkit-transform: scale(1);
206-
transform: scale(1);
207-
opacity: 0;
208-
}
196+
50% {
197+
transform: scale(1);
209198
}
199+
`
210200

211-
@keyframes sk-pulseScaleOut {
212-
0% {
213-
-webkit-transform: scale(0);
214-
transform: scale(0);
215-
}
216-
100% {
217-
-webkit-transform: scale(1);
218-
transform: scale(1);
219-
opacity: 0;
220-
}
221-
}
201+
const Pulse = styled.div`
202+
width: 16px;
203+
height: 16px;
204+
background-color: ${spinnerColor};
205+
border-radius: 100%;
206+
animation: ${bounceAnimation} 2s infinite ease-in-out;
207+
-webkit-animation: ${bounceAnimation} 2s infinite ease-in-out;
208+
`
209+
210+
const DelayedPulse = styled.div`
211+
width: 16px;
212+
height: 16px;
213+
position: absolute;
214+
top: 0;
215+
background-color: ${spinnerColor};
216+
border-radius: 100%;
217+
animation: ${bounceAnimation} 2s infinite ease-in-out;
218+
-webkit-animation: ${bounceAnimation} 2s infinite ease-in-out;
219+
animation-delay: -1s;
220+
-webkit-animation-delay: -1.0s;
222221
`
222+
223+
const SpinnerWrapper = styled.div`
224+
position: relative;
225+
margin: 6px;
226+
`
227+
228+
const Spinner = () => (
229+
<SpinnerWrapper>
230+
<Pulse />
231+
<DelayedPulse />
232+
</SpinnerWrapper>
233+
)

0 commit comments

Comments
 (0)