Skip to content

Commit d095d00

Browse files
committed
Cleanup
1 parent d1df4bf commit d095d00

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

packages/app/src/app/pages/common/Modals/StorageManagementModal/FilesList/AddFileToSandboxButton.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export const AddFileToSandboxButton: FunctionComponent<Props> = ({
2020
},
2121
} = useOvermind();
2222

23+
if (!currentSandbox) {
24+
return null;
25+
}
26+
2327
return (
2428
<Button
2529
disabled={!currentSandbox}

packages/app/src/app/pages/common/Modals/StorageManagementModal/FilesList/Button/elements.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
import TooltipBase from '@codesandbox/common/lib/components/Tooltip';
22
import styled from 'styled-components';
33

4+
export const ButtonComponent = styled.button`
5+
font-size: 1.2em;
6+
background-color: inherit;
7+
border: none;
8+
padding: 5px 6px 9px 6px;
9+
color: rgba(255, 255, 255, 0.5);
10+
cursor: pointer;
11+
12+
&:hover {
13+
color: rgba(255, 255, 255, 1);
14+
}
15+
16+
&[disabled] {
17+
opacity: 0.5;
18+
cursor: default;
19+
}
20+
`;
21+
422
export const Tooltip = styled(TooltipBase)`
523
font-size: 1.2em;
624
background-color: inherit;

packages/app/src/app/pages/common/Modals/StorageManagementModal/FilesList/Button/index.tsx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
import React, { ComponentType, FunctionComponent, HTMLAttributes } from 'react';
2-
import styled from 'styled-components';
3-
import { Tooltip } from './elements';
4-
5-
const ButtonComponent = styled.button`
6-
font-size: 1.2em;
7-
background-color: inherit;
8-
border: none;
9-
padding: 5px 6px 9px 6px;
10-
color: rgba(255, 255, 255, 0.5);
11-
cursor: pointer;
12-
&:hover {
13-
color: rgba(255, 255, 255, 1);
14-
}
15-
&[disabled] {
16-
opacity: 0.5;
17-
cursor: default;
18-
}
19-
`;
2+
import { ButtonComponent, Tooltip } from './elements';
203

214
type Props = {
225
disabled?: boolean;
@@ -30,7 +13,7 @@ export const Button: FunctionComponent<Props> = ({
3013
tooltip,
3114
}) => (
3215
<Tooltip content={tooltip} isEnabled={!disabled}>
33-
<ButtonComponent type="button" onClick={onClick}>
16+
<ButtonComponent onClick={onClick} type="button">
3417
<Icon />
3518
</ButtonComponent>
3619
</Tooltip>

packages/app/src/app/pages/common/Modals/StorageManagementModal/FilesList/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ export const FilesList: FunctionComponent = () => {
116116
cursor: pointer;
117117
`}
118118
>
119-
{currentSandbox && (
120-
<AddFileToSandboxButton name={name} url={url} />
121-
)}
119+
<AddFileToSandboxButton name={name} url={url} />
122120
</StatBody>
123121

124122
<StatBody

0 commit comments

Comments
 (0)