Skip to content

Commit a4bada5

Browse files
committed
refactor(to-sc): Playground and Popup
1 parent 132c3f6 commit a4bada5

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

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

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { isEqual, mapValues } from 'lodash'
4141
import Share from './Share'
4242
import NewPermissionTab from './Permissions/NewPermissionTab'
4343
import { serviceInformationQuery } from './constants'
44-
import { ThemeProvider, theme as styledTheme } from '../styled'
44+
import styled, { ThemeProvider, theme as styledTheme } from '../styled'
4545

4646
export type Theme = 'dark' | 'light'
4747
export type Viewer = 'ADMIN' | 'EVERYONE' | 'USER'
@@ -586,42 +586,7 @@ export class Playground extends React.PureComponent<Props & DocsState, State> {
586586
return (
587587
<ThemeProvider theme={{ ...styledTheme, mode: theme }}>
588588
<OldThemeProvider theme={this.state.theme}>
589-
<div className={cx('playground')}>
590-
<style jsx={true}>{`
591-
.playground {
592-
@p: .h100, .flex, .flexColumn;
593-
margin: 0;
594-
padding: 0;
595-
overflow: hidden;
596-
font-family: 'Open Sans', sans-serif;
597-
-webkit-font-smoothing: antialiased;
598-
-moz-osx-font-smoothing: grayscale;
599-
color: rgba(0, 0, 0, 0.8);
600-
line-height: 1.5;
601-
letter-spacing: 0.53px;
602-
margin-right: -1px !important;
603-
}
604-
605-
.blur {
606-
filter: blur(5px);
607-
}
608-
609-
.graphiqls-container {
610-
@p: .relative, .overflowHidden;
611-
height: calc(100vh - 57px);
612-
}
613-
614-
.graphiql-wrapper {
615-
@p: .w100, .h100, .relative;
616-
}
617-
618-
.playground :global(a:active),
619-
.playground :global(a:focus),
620-
.playground :global(button:focus),
621-
.playground :global(input:focus) {
622-
outline: none;
623-
}
624-
`}</style>
589+
<PlaygroundWrapper className="playground">
625590
<TabBar
626591
sessions={sessions}
627592
selectedSessionIndex={selectedSessionIndex}
@@ -634,13 +599,13 @@ export class Playground extends React.PureComponent<Props & DocsState, State> {
634599
tether={this.props.tether}
635600
isApp={this.props.isApp}
636601
/>
637-
<div
602+
<GraphiqlsContainer
638603
className={cx('graphiqls-container', {
639604
'docs-graphiql': theme === 'light',
640605
})}
641606
>
642607
{sessions.map((session, index) => (
643-
<div
608+
<GraphiqlWrapper
644609
key={session.id}
645610
className={cx('graphiql-wrapper', {
646611
active: index === selectedSessionIndex,
@@ -689,9 +654,9 @@ export class Playground extends React.PureComponent<Props & DocsState, State> {
689654
permission={session.permission}
690655
serviceInformation={this.state.serviceInformation}
691656
/>
692-
</div>
657+
</GraphiqlWrapper>
693658
))}
694-
</div>
659+
</GraphiqlsContainer>
695660
<Settings
696661
onToggleTheme={this.toggleTheme}
697662
localTheme={this.state.theme}
@@ -746,7 +711,7 @@ export class Playground extends React.PureComponent<Props & DocsState, State> {
746711
this.renderUserPopup()}
747712
{this.state.codeGenerationPopupOpen &&
748713
this.renderCodeGenerationPopup()}
749-
</div>
714+
</PlaygroundWrapper>
750715
</OldThemeProvider>
751716
</ThemeProvider>
752717
)
@@ -1675,3 +1640,40 @@ function isSharingAuthorization(sharableSessions: Session[]): boolean {
16751640

16761641
return false
16771642
}
1643+
1644+
const PlaygroundWrapper = styled.div`
1645+
display: flex;
1646+
flex-direction: column;
1647+
1648+
height: 100%;
1649+
margin: 0;
1650+
padding: 0;
1651+
overflow: hidden;
1652+
margin-right: -1px !important;
1653+
1654+
line-height: 1.5;
1655+
font-family: 'Open Sans', sans-serif;
1656+
-webkit-font-smoothing: antialiased;
1657+
-moz-osx-font-smoothing: grayscale;
1658+
letter-spacing: 0.53px;
1659+
color: rgba(0, 0, 0, 0.8);
1660+
1661+
a:active,
1662+
a:focus,
1663+
button:focus,
1664+
input:focus {
1665+
outline: none;
1666+
}
1667+
`
1668+
1669+
const GraphiqlsContainer = styled.div`
1670+
height: calc(100vh - 57px);
1671+
position: relative;
1672+
overflow: hidden;
1673+
`
1674+
1675+
const GraphiqlWrapper = styled.div`
1676+
width: 100%;
1677+
height: 100%;
1678+
position: relative;
1679+
`

packages/graphql-playground/src/components/Popup.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,4 @@ export default class Popup extends React.Component<Props, {}> {
6060
}
6161
}
6262

63-
const ContentWrapper = styled.div`
64-
border-radius: ${p => p.theme.sizes.smallRadius};
65-
`
63+
const ContentWrapper = styled.div``

0 commit comments

Comments
 (0)