Skip to content

Commit f9ad7eb

Browse files
authored
Adjust styling of files entry containers (codesandbox#322)
* Adjust styling of files * Different folder icon for open and closed * Update snapshots
1 parent ebf6d23 commit f9ad7eb

File tree

6 files changed

+37
-32
lines changed

6 files changed

+37
-32
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/Dependencies/__snapshots__/ExternalResource.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`ExternalResource renders file if there is an extension 1`] = `
44
<span
5-
className="sc-bdVaJa jEUgPD"
5+
className="sc-bdVaJa dllDpZ"
66
>
77
<a
88
href="https://ivesvh.com/ives.js"
@@ -44,7 +44,7 @@ exports[`ExternalResource renders file if there is an extension 1`] = `
4444

4545
exports[`ExternalResource renders url if there is no extension 1`] = `
4646
<span
47-
className="sc-bdVaJa jEUgPD"
47+
className="sc-bdVaJa dllDpZ"
4848
>
4949
<a
5050
href="https://ivesvh.com/"
@@ -86,7 +86,7 @@ exports[`ExternalResource renders url if there is no extension 1`] = `
8686

8787
exports[`ExternalResource renders url if there is no extension 2`] = `
8888
<span
89-
className="sc-bdVaJa jEUgPD"
89+
className="sc-bdVaJa dllDpZ"
9090
>
9191
<a
9292
href="https://ivesvh.com"

packages/app/src/app/pages/Sandbox/Editor/Workspace/EntryContainer.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ export const getContainerStyles = props => {
1212
position: relative;
1313
display: flex;
1414
font-size: 14px;
15-
padding: 0.6rem;
16-
padding-left: ${props.depth != null
17-
? `${props.depth + 1.5}rem`
18-
: 'calc(1rem - 2px)'};
15+
padding: 0.4rem;
16+
padding-left: ${
17+
props.depth != null ? `${props.depth + 1.5}rem` : 'calc(1rem - 2px)'
18+
};
1919
padding-right: 3rem;
20-
color: ${theme.background.lighten(2)()};
20+
color: rgba(255, 255, 255, 0.5);
2121
text-decoration: none;
2222
font-weight: 400;
2323
min-width: 100px;
@@ -26,13 +26,15 @@ export const getContainerStyles = props => {
2626
user-select: none;
2727
2828
&:hover {
29-
${props.active || props.editing
30-
? ''
31-
: `
29+
${
30+
props.active || props.editing
31+
? ''
32+
: `
3233
background-color: ${color.clearer(0.9)()};
3334
color: ${theme.background.lighten(5)()};
3435
border-color: ${color.darken(0.4)()};
35-
`}
36+
`
37+
}
3638
3739
> div {
3840
opacity: 1 !important;

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import styled from 'styled-components';
44
import ProjectIcon from 'react-icons/lib/go/file-code';
55
import FunctionIcon from 'react-icons/lib/fa/code';
66
import FolderIcon from 'react-icons/lib/md/keyboard-arrow-down';
7-
import DirectoryIcon from 'react-icons/lib/go/file-directory';
7+
import DirectoryIcon from 'react-icons/lib/md/folder';
8+
import DirectoryOpenIcon from 'react-icons/lib/md/folder-open';
89
import NotSyncedIcon from 'react-icons/lib/go/primitive-dot';
910
import CSSIcon from 'react-icons/lib/fa/css3';
1011
import HTMLIcon from 'react-icons/lib/fa/html5';
@@ -19,7 +20,9 @@ const NotSyncedIconWithMargin = styled(NotSyncedIcon)`
1920
color: ${props => props.theme.templateColor || props.theme.secondary};
2021
`;
2122

22-
const RedIcon = styled.span`color: ${props => props.theme.red};`;
23+
const RedIcon = styled.span`
24+
color: ${props => props.theme.red};
25+
`;
2326

2427
const StyledFolderIcon = styled.span`
2528
svg {
@@ -31,7 +34,7 @@ const StyledFolderIcon = styled.span`
3134
}
3235
`;
3336

34-
const getIcon = (type, error, root) => {
37+
const getIcon = (type, error, root, open) => {
3538
if (root) {
3639
return <ProjectIcon />;
3740
}
@@ -51,7 +54,7 @@ const getIcon = (type, error, root) => {
5154
case 'function':
5255
return <FunctionIcon />;
5356
case 'directory':
54-
return <DirectoryIcon />;
57+
return open ? <DirectoryOpenIcon /> : <DirectoryIcon />;
5558
case 'css':
5659
return <CSSIcon />;
5760
case 'ts':
@@ -85,12 +88,12 @@ export default function EntryIcon({
8588
<div style={{ display: 'inline-block', verticalAlign: 'middle' }}>
8689
{isNotSynced && <NotSyncedIconWithMargin />}
8790
{type === 'directory' &&
88-
hasChildren && (
89-
<StyledFolderIcon isOpen={isOpen} onClick={onOpen}>
90-
<FolderIcon />
91-
</StyledFolderIcon>
92-
)}
93-
{getIcon(type, error, root)}
91+
hasChildren && (
92+
<StyledFolderIcon isOpen={isOpen} onClick={onOpen}>
93+
<FolderIcon />
94+
</StyledFolderIcon>
95+
)}
96+
{getIcon(type, error, root, isOpen)}
9497
</div>
9598
);
9699
}

packages/app/src/app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryTitleInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import styled from 'styled-components';
44

55
const InputContainer = styled.div`
66
display: inline-block;
7-
overflow: visible;
7+
overflow: auto;
88
input {
99
transition: 0.3s ease all;
1010
font-family: inherit;

packages/app/src/app/pages/Sandbox/Editor/Workspace/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const Container = styled.div`
4747
background-color: ${props => props.theme.background};
4848
height: 100%;
4949
width: 100%;
50-
overflow: auto;
5150
overflow-y: overlay;
51+
overflow-x: auto;
5252
5353
> div {
5454
${fadeIn(0)};

packages/app/src/embed/components/__snapshots__/File.test.js.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ exports[`File renders 1`] = `
88
display: -ms-flexbox;
99
display: flex;
1010
font-size: 14px;
11-
padding: 0.6rem;
11+
padding: 0.4rem;
1212
padding-left: calc(1rem - 2px);
1313
padding-right: 3rem;
14-
color: rgb(106,118,124);
14+
color: rgba(255,255,255,0.5);
1515
text-decoration: none;
1616
font-weight: 400;
1717
min-width: 100px;
@@ -89,10 +89,10 @@ exports[`File renders alternative 1`] = `
8989
display: -ms-flexbox;
9090
display: flex;
9191
font-size: 14px;
92-
padding: 0.6rem;
92+
padding: 0.4rem;
9393
padding-left: calc(1rem - 2px);
9494
padding-right: 3rem;
95-
color: rgb(106,118,124);
95+
color: rgba(255,255,255,0.5);
9696
text-decoration: none;
9797
font-weight: 400;
9898
min-width: 100px;
@@ -170,10 +170,10 @@ exports[`File renders as active 1`] = `
170170
display: -ms-flexbox;
171171
display: flex;
172172
font-size: 14px;
173-
padding: 0.6rem;
173+
padding: 0.4rem;
174174
padding-left: calc(1rem - 2px);
175175
padding-right: 3rem;
176-
color: rgb(106,118,124);
176+
color: rgba(255,255,255,0.5);
177177
text-decoration: none;
178178
font-weight: 400;
179179
min-width: 100px;
@@ -248,10 +248,10 @@ exports[`File renders directory 1`] = `
248248
display: -ms-flexbox;
249249
display: flex;
250250
font-size: 14px;
251-
padding: 0.6rem;
251+
padding: 0.4rem;
252252
padding-left: calc(1rem - 2px);
253253
padding-right: 3rem;
254-
color: rgb(106,118,124);
254+
color: rgba(255,255,255,0.5);
255255
text-decoration: none;
256256
font-weight: 400;
257257
min-width: 100px;

0 commit comments

Comments
 (0)