File tree Expand file tree Collapse file tree 3 files changed +55
-38
lines changed
packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/ProjectInfo Expand file tree Collapse file tree 3 files changed +55
-38
lines changed Original file line number Diff line number Diff line change 11import React , { MouseEvent } from 'react' ;
22import getTemplateDefinition from '@codesandbox/common/lib/templates' ;
33import { useOvermind } from 'app/overmind' ;
4- import { css } from '@styled-system/css' ;
5- import { Button , Element , Stack } from '@codesandbox/components' ;
4+ import { Button , Element } from '@codesandbox/components' ;
65
76export const Config = ( ) => {
87 const {
98 actions : {
109 modalOpened,
11- workspace : { addedTemplate, deleteTemplate } ,
10+ workspace : { addedTemplate } ,
1211 } ,
1312 state : {
1413 user,
@@ -21,16 +20,6 @@ export const Config = () => {
2120 } ,
2221 } = useOvermind ( ) ;
2322
24- const onDelete = ( event : MouseEvent < HTMLButtonElement > ) => {
25- event . preventDefault ( ) ;
26-
27- if ( customTemplate ) {
28- deleteTemplate ( ) ;
29- } else {
30- modalOpened ( { modal : 'deleteSandbox' } ) ;
31- }
32- } ;
33-
3423 const onCreateTemplate = ( event : MouseEvent < HTMLButtonElement > ) => {
3524 event . preventDefault ( ) ;
3625
@@ -60,26 +49,6 @@ export const Config = () => {
6049 </ Button >
6150 </ Element >
6251 ) }
63-
64- < Stack
65- justify = "center"
66- css = { css ( {
67- bottom : 3 ,
68- position : 'absolute' ,
69- width : '100%' ,
70- } ) }
71- >
72- < Button
73- // @ts -ignore
74- onClick = { onDelete }
75- variant = "link"
76- css = { css ( {
77- ':hover,:focus' : { color : 'dangerButton.background' } ,
78- } ) }
79- >
80- { `Delete ${ customTemplate ? `Template` : `Sandbox` } ` }
81- </ Button >
82- </ Stack >
8352 </ >
8453 ) ;
8554} ;
Original file line number Diff line number Diff line change 1+ import React , { MouseEvent } from 'react' ;
2+ import { useOvermind } from 'app/overmind' ;
3+ import { css } from '@styled-system/css' ;
4+ import { Button , Stack } from '@codesandbox/components' ;
5+
6+ export const Delete = ( ) => {
7+ const {
8+ actions : {
9+ modalOpened,
10+ workspace : { deleteTemplate } ,
11+ } ,
12+ state : {
13+ editor : {
14+ currentSandbox : { customTemplate } ,
15+ } ,
16+ } ,
17+ } = useOvermind ( ) ;
18+
19+ const onDelete = ( event : MouseEvent < HTMLButtonElement > ) => {
20+ event . preventDefault ( ) ;
21+
22+ if ( customTemplate ) {
23+ deleteTemplate ( ) ;
24+ } else {
25+ modalOpened ( { modal : 'deleteSandbox' } ) ;
26+ }
27+ } ;
28+
29+ return (
30+ < Stack justify = "center" marginBottom = { 3 } >
31+ < Button
32+ // @ts -ignore
33+ onClick = { onDelete }
34+ variant = "link"
35+ css = { css ( {
36+ ':hover,:focus' : { color : 'errorForeground' } ,
37+ } ) }
38+ >
39+ { `Delete ${ customTemplate ? `Template` : `Sandbox` } ` }
40+ </ Button >
41+ </ Stack >
42+ ) ;
43+ } ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import { Stack } from '@codesandbox/components' ;
23import { Summary } from './Summary' ;
34import { Privacy } from './Privacy' ;
45import { Config } from './Config' ;
6+ import { Delete } from './Delete' ;
57
68export const ProjectInfo = ( ) => (
7- < >
8- < Summary />
9- < Privacy />
10- < Config />
11- </ >
9+ < Stack direction = "vertical" justify = "space-between" css = { { height : '100%' } } >
10+ < div >
11+ < Summary />
12+ < Privacy />
13+ < Config />
14+ </ div >
15+ < Delete />
16+ </ Stack >
1217) ;
You can’t perform that action at this time.
0 commit comments