Skip to content

Commit a2fc116

Browse files
authored
Handle long names in the sidebar (codesandbox#3719)
1 parent e8fe97d commit a2fc116

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/Explorer/Files/DirectoryEntry/Entry/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ const Entry: React.FC<IEntryProps> = ({
196196
},
197197
}}
198198
>
199-
<Stack gap={2} align="center">
199+
<Stack gap={2} align="center" css={{ width: '100%' }}>
200200
<EntryIcons type={type} error={moduleHasError} />
201201
{state === 'editing' ? (
202202
<FileInput
@@ -216,7 +216,7 @@ const Entry: React.FC<IEntryProps> = ({
216216
})}
217217
/>
218218
) : (
219-
<Text maxWidth={150}>{title}</Text>
219+
<Text maxWidth="100%">{title}</Text>
220220
)}
221221
{isNotSynced && !state && (
222222
<NotSyncedIcon css={css({ color: 'blues.300' })} />

packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/NotOwnedSandboxInfo/Summary.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ export const Summary = () => {
6262
iconUrl={customTemplate.iconUrl}
6363
environment={template}
6464
/>
65-
<Text maxWidth={190}>{getSandboxName(currentSandbox)}</Text>
65+
<Text maxWidth="100%">{getSandboxName(currentSandbox)}</Text>
6666
</Stack>
6767
) : (
68-
<Text maxWidth={190}>{getSandboxName(currentSandbox)}</Text>
68+
<Text maxWidth="100%">{getSandboxName(currentSandbox)}</Text>
6969
)}
7070
</Stack>
7171

@@ -120,9 +120,14 @@ export const Summary = () => {
120120
</Link>
121121
</ListItem>
122122
) : null}
123-
<ListItem justify="space-between">
123+
<ListItem justify="space-between" gap={2}>
124124
<Text>Environment</Text>
125-
<Link variant="muted" href={templateUrl} target="_blank">
125+
<Link
126+
variant="muted"
127+
href={templateUrl}
128+
target="_blank"
129+
maxWidth="100%"
130+
>
126131
{template}
127132
</Link>
128133
</ListItem>

packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/ProjectInfo/Summary.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ export const Summary = () => {
9292
iconUrl={customTemplate.iconUrl}
9393
environment={template}
9494
/>
95-
<Text maxWidth={190}>{getSandboxName(currentSandbox)}</Text>
95+
<Text maxWidth="100%">
96+
{getSandboxName(currentSandbox)}
97+
</Text>
9698
</Stack>
9799
) : (
98-
<Text maxWidth={190}>{getSandboxName(currentSandbox)}</Text>
100+
<Text maxWidth="100%">{getSandboxName(currentSandbox)}</Text>
99101
)}
100102
<Button
101103
variant="link"
@@ -129,7 +131,12 @@ export const Summary = () => {
129131
{author.username}
130132
</Text>
131133
{team && (
132-
<Text size={2} marginTop={1} variant="muted">
134+
<Text
135+
size={2}
136+
marginTop={1}
137+
variant="muted"
138+
maxWidth="100%"
139+
>
133140
{team.name}
134141
</Text>
135142
)}
@@ -165,9 +172,14 @@ export const Summary = () => {
165172
</Link>
166173
</ListItem>
167174
) : null}
168-
<ListItem justify="space-between">
175+
<ListItem justify="space-between" gap={2}>
169176
<Text>Environment</Text>
170-
<Link variant="muted" href={templateUrl} target="_blank">
177+
<Link
178+
variant="muted"
179+
href={templateUrl}
180+
target="_blank"
181+
maxWidth="100%"
182+
>
171183
{template}
172184
</Link>
173185
</ListItem>

packages/components/src/components/Avatar/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const AvatarContainer = styled(Element).attrs({ as: 'span' })(
2121
height: 8,
2222
width: 8,
2323
position: 'relative',
24+
flexShrink: 0, // avatars should never shrink inside flex
2425
})
2526
);
2627

packages/components/src/components/Text/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export const Text = styled(Element).attrs({ as: 'span' })<ITextProps>(
2929
fontSize: size || 'inherit', // from theme.fontSizes
3030
textAlign: align || 'left',
3131
fontWeight: weight || null, // from theme.fontWeights
32-
display: block ? 'block' : 'inline',
3332
color: variants[variant],
3433
maxWidth,
3534
...(maxWidth ? overflowStyles : {}),
35+
display: block || maxWidth ? 'block' : 'inline',
3636
})
3737
);

0 commit comments

Comments
 (0)