-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
143 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/app/src/app/components/Preview/DevTools/TerminalUpgrade/elements.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const StyledTitle = styled.div` | ||
display: flex; | ||
align-items: center; | ||
font-weight: 600; | ||
font-size: 1rem; | ||
color: ${props => | ||
props.theme.light ? 'rgba(0, 0, 0, 0.4)' : 'rgba(255, 255, 255, 0.4)'}; | ||
width: 100%; | ||
padding: 1rem; | ||
border-bottom: 2px solid; | ||
border-color: ${props => | ||
props.theme.light ? 'rgba(0, 0, 0, 0.3)' : 'rgba(255, 255, 255, 0.3)'}; | ||
`; |
101 changes: 101 additions & 0 deletions
101
packages/app/src/app/components/Preview/DevTools/TerminalUpgrade/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { Button, ThemeProvider, Text, Stack } from '@codesandbox/components'; | ||
import React from 'react'; | ||
import themeType from '@codesandbox/common/lib/theme'; | ||
|
||
import { withTheme } from 'styled-components'; | ||
import { useUpgradeFromV1ToV2 } from 'app/hooks/useUpgradeFromV1ToV2'; | ||
import { DevToolProps } from '..'; | ||
import { StyledTitle } from './elements'; | ||
|
||
type StyledProps = DevToolProps & { | ||
theme: typeof themeType & { light: boolean }; | ||
}; | ||
|
||
export const TerminalUpgradeComponent: React.FC<StyledProps> = ({ | ||
hidden, | ||
theme, | ||
}) => { | ||
const { perform, loading, canConvert } = useUpgradeFromV1ToV2('Terminal Tab'); | ||
|
||
if (hidden) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<ThemeProvider theme={theme.vscodeTheme}> | ||
<Stack | ||
direction="vertical" | ||
css={{ | ||
width: '100%', | ||
}} | ||
> | ||
<StyledTitle>Terminal</StyledTitle> | ||
<Stack | ||
direction="vertical" | ||
css={{ | ||
padding: '1rem', | ||
}} | ||
gap={4} | ||
> | ||
<Text> | ||
To use the terminal, you need to upgrade your Browser Sandbox into a | ||
Cloud Sandbox. | ||
</Text> | ||
<Text> | ||
Cloud Sandboxes are an improved coding experience that run your code | ||
in the cloud. They allow you to run Docker, code in new languages, | ||
add servers, databases, and much more. See a preview below. | ||
</Text> | ||
<img alt="" src="/static/img/terminal_upgrade_screenshot.png" /> | ||
<Text> | ||
{canConvert | ||
? `Do you want to convert it into a Cloud Sandbox?` | ||
: `Do you want to fork into a Cloud Sandbox?`} | ||
</Text> | ||
<Stack | ||
direction="horizontal" | ||
gap={4} | ||
css={{ | ||
justifyContent: 'start', | ||
}} | ||
> | ||
<Button | ||
onClick={perform} | ||
loading={loading} | ||
css={{ | ||
width: 'inherit', | ||
paddingLeft: '1rem', | ||
paddingRight: '1rem', | ||
}} | ||
> | ||
Yes, {canConvert ? 'convert' : 'fork and convert'} | ||
</Button> | ||
<Button | ||
as="a" | ||
variant="link" | ||
style={{ | ||
width: 'inherit', | ||
display: 'flex', | ||
alignItems: 'center', | ||
backgroundColor: 'transparent', | ||
color: 'mutedForeground', | ||
}} | ||
target="_blank" | ||
rel="noreferrer noopener" | ||
href="https://codesandbox.io/docs/learn/sandboxes/overview?tab=cloud" | ||
> | ||
Learn more | ||
</Button> | ||
</Stack> | ||
</Stack> | ||
</Stack> | ||
</ThemeProvider> | ||
); | ||
}; | ||
|
||
export const terminalUpgrade = { | ||
id: 'codesandbox.terminalUpgrade', | ||
title: 'Terminal', | ||
Content: withTheme(TerminalUpgradeComponent), | ||
actions: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters