Skip to content

Commit 000946f

Browse files
committed
Revert "style(TopBar): fade in/out the error message if the endpoint is unreachable"
This reverts commit 19b90a4.
1 parent 19b90a4 commit 000946f

File tree

1 file changed

+41
-29
lines changed
  • packages/graphql-playground-react/src/components/Playground/TopBar

1 file changed

+41
-29
lines changed

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

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react'
2-
import { styled, keyframes, withProps } from '../../../styled'
2+
import { styled } from '../../../styled/index'
33
import * as theme from 'styled-theming'
44
import { darken, lighten } from 'polished'
55
import * as CopyToClipboard from 'react-copy-to-clipboard'
@@ -23,10 +23,6 @@ export interface Props {
2323
endpointUnreachable: boolean
2424
}
2525

26-
interface ErrorMessageProps {
27-
visibleIf: boolean
28-
}
29-
3026
export default class TopBar extends React.Component<Props, {}> {
3127
render() {
3228
const { endpointUnreachable } = this.props
@@ -43,14 +39,17 @@ export default class TopBar extends React.Component<Props, {}> {
4339
disabled={this.props.fixedEndpoint}
4440
className={cx({ active: !this.props.fixedEndpoint })}
4541
/>
46-
<ReachError visibleIf={endpointUnreachable}>
47-
<span>Server cannot be reached</span>
48-
<Spinner />
49-
</ReachError>
50-
<ReloadIcon
51-
isReloadingSchema={this.props.isReloadingSchema}
52-
onReloadSchema={this.props.onReloadSchema}
53-
/>
42+
{endpointUnreachable ? (
43+
<ReachError>
44+
<span>Server cannot be reached</span>
45+
<Spinner />
46+
</ReachError>
47+
) : (
48+
<ReloadIcon
49+
isReloadingSchema={this.props.isReloadingSchema}
50+
onReloadSchema={this.props.onReloadSchema}
51+
/>
52+
)}
5453
</UrlBarWrapper>
5554
<CopyToClipboard text={this.props.curl}>
5655
<Button>Copy CURL</Button>
@@ -154,33 +153,46 @@ const UrlBarWrapper = styled.div`
154153
align-items: center;
155154
`
156155

157-
const ReachError = withProps<ErrorMessageProps>()(styled.div) `
158-
opacity: ${p => p.visibleIf ? 1 : 0};
159-
transition: opacity 0.5s ease-out;
156+
const ReachError = styled.div`
160157
position: absolute;
161-
right: -5px;
158+
right: 5px;
162159
display: flex;
163160
align-items: center;
164-
justify-content: flex-end;
165161
color: #f25c54;
166-
user-select: none;
167162
`
168163

169-
const pulseScaleOut = keyframes`
164+
const Spinner = styled.div`
165+
& {
166+
width: 40px;
167+
height: 40px;
168+
margin: 40px auto;
169+
background-color: #333;
170+
border-radius: 100%;
171+
-webkit-animation: sk-pulseScaleOut 1s infinite ease-in-out;
172+
animation: sk-pulseScaleOut 1s infinite ease-in-out;
173+
}
174+
175+
@-webkit-keyframes sk-pulseScaleOut {
170176
0% {
177+
-webkit-transform: scale(0);
171178
transform: scale(0);
172179
}
173180
100% {
181+
-webkit-transform: scale(1);
174182
transform: scale(1);
175183
opacity: 0;
176184
}
177-
`
185+
}
178186
179-
const Spinner = styled.div`
180-
width: 40px;
181-
height: 40px;
182-
margin: 40px auto;
183-
background-color: #333;
184-
border-radius: 100%;
185-
animation: ${pulseScaleOut} 1s infinite ease-in-out;
186-
`
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+
}
197+
}
198+
`

0 commit comments

Comments
 (0)