diff --git a/packages/app/src/app/pages/common/Modals/ForkServerModal/elements.ts b/packages/app/src/app/pages/common/Modals/ForkServerModal/elements.ts new file mode 100644 index 00000000000..ef82993b3ce --- /dev/null +++ b/packages/app/src/app/pages/common/Modals/ForkServerModal/elements.ts @@ -0,0 +1,11 @@ +import styled from 'styled-components'; + +import { SignInButton as SignInButtonBase } from 'app/pages/common/SignInButton'; + +export const NiceName = styled.span` + font-weight: 500; +`; + +export const SignInButton = styled(SignInButtonBase)` + margin-top: 12px; +`; diff --git a/packages/app/src/app/pages/common/Modals/ForkServerModal/index.tsx b/packages/app/src/app/pages/common/Modals/ForkServerModal/index.tsx index 3c407bee998..aa516559dd2 100644 --- a/packages/app/src/app/pages/common/Modals/ForkServerModal/index.tsx +++ b/packages/app/src/app/pages/common/Modals/ForkServerModal/index.tsx @@ -1,48 +1,53 @@ -import React, { useEffect } from 'react'; -import { useOvermind } from 'app/overmind'; import getTemplateDefinition from '@codesandbox/common/lib/templates'; -import { SignInButton } from 'app/pages/common/SignInButton'; +import React, { FunctionComponent, useEffect } from 'react'; + +import { useOvermind } from 'app/overmind'; import { Container, Heading, Explanation } from '../elements'; -export const ForkServerModal: React.FC = () => { +import { NiceName as NiceNameBase, SignInButton } from './elements'; + +export const ForkServerModal: FunctionComponent = () => { const { - state: { - isLoggedIn, - editor: { currentSandbox }, - }, actions: { - modalClosed, editor: { forkSandboxClicked }, + modalClosed, + }, + state: { + editor: { + currentSandbox: { template }, + }, + isLoggedIn, }, } = useOvermind(); useEffect(() => { - // Which means that the user signed in in the meantime with the intention to - // fork + // Which means that the user signed in in the meantime with the intention to fork if (isLoggedIn) { forkSandboxClicked(); + modalClosed(); } }, [forkSandboxClicked, isLoggedIn, modalClosed]); - const templateDefinition = getTemplateDefinition(currentSandbox.template); - const niceName = ( - - {templateDefinition.niceName} - + const { color, niceName } = getTemplateDefinition(template); + const NiceName: FunctionComponent = () => ( + {niceName} ); return ( - Fork {niceName} Sandbox + + Fork Sandbox + + - We execute {niceName} sandboxes in a server container. This is still in - beta, so we require you to sign in before you can fork a {niceName}{' '} + We execute sandboxes in a server container. This is still + in beta, so we require you to sign in before you can fork a {' '} sandbox. - + ); };