Skip to content

Commit a662785

Browse files
authored
Merge pull request #38 from code-hike/better-tab-styles
Improve editor tab styles
2 parents 362dbf0 + 929928d commit a662785

File tree

7 files changed

+4260
-221
lines changed

7 files changed

+4260
-221
lines changed

external/new-react-website

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
},
99
"scripts": {
1010
"build": "lerna run --stream x -- build",
11-
"watch": "lerna run --since HEAD --parallel x -- watch",
11+
"watch": "lerna run --since HEAD --exclude-dependents --parallel x -- watch",
1212
"watch-package": "lerna run --scope @*/mini-frame --include-dependencies --parallel x -- watch",
1313
"watch-all": "lerna run --parallel x -- watch",
1414
"storybook": "lerna run --scope storybook start --stream",
15+
"dev": "lerna run --scope react-website dev --stream",
1516
"release": "auto shipit"
1617
},
1718
"devDependencies": {

packages/mini-editor/src/editor-frame.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ function EditorFrame({
3838
files={files}
3939
active={active}
4040
button={button}
41-
classes={classes}
4241
/>
4342
}
4443
classes={classes}
@@ -55,13 +54,11 @@ type TabsContainerProps = {
5554
files: string[]
5655
active: string
5756
button?: React.ReactNode
58-
classes?: Classes
5957
}
6058
function TabsContainer({
6159
files,
6260
active,
6361
button,
64-
classes,
6562
}: TabsContainerProps) {
6663
const c = useClasser("ch-editor-tab")
6764
return (
@@ -70,6 +67,7 @@ function TabsContainer({
7067
{files.map(fileName => (
7168
<div
7269
key={fileName}
70+
title={fileName}
7371
className={c(
7472
"",
7573
fileName === active ? "active" : "inactive"

packages/mini-editor/src/index.scss

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
border-right: 1px solid rgb(37, 37, 38);
88
width: 120px;
99
min-width: fit-content;
10-
flex-shrink: 0;
10+
flex-shrink: 1;
1111
position: relative;
1212
display: flex;
1313
white-space: nowrap;
@@ -18,11 +18,13 @@
1818
padding-right: 15px;
1919
background-color: rgb(45, 45, 45);
2020
color: rgba(255, 255, 255, 0.5);
21+
min-width: 0;
2122
}
2223

2324
.ch-editor-tab-active {
2425
background-color: rgb(30, 30, 30);
2526
color: rgb(255, 255, 255);
27+
min-width: unset;
2628
}
2729

2830
.ch-editor-tab > div {
@@ -31,6 +33,7 @@
3133
font-size: 12px;
3234
line-height: 1.4em;
3335
text-overflow: ellipsis;
36+
overflow: hidden;
3437
}
3538

3639
/** body */

packages/storybook/package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
{
22
"name": "storybook",
33
"private": true,
4+
"version": "0.3.0-next.0",
45
"scripts": {
56
"start": "start-storybook -c ./src",
67
"build": "build-storybook -c ./src -o ./dist"
78
},
89
"dependencies": {
9-
"@code-hike/mini-browser": "0.0.0-4333a8b",
10-
"@code-hike/mini-frame": "0.0.0-4333a8b",
11-
"@code-hike/mini-terminal": "0.0.0-4333a8b",
12-
"@code-hike/player": "0.0.0-4333a8b",
13-
"@code-hike/scroller": "0.0.0-4333a8b",
14-
"@code-hike/scrollycoding": "0.0.0-4333a8b",
15-
"@code-hike/sim-user": "0.0.0-4333a8b",
16-
"@code-hike/smooth-column": "0.0.0-4333a8b",
17-
"@code-hike/smooth-lines": "0.0.0-4333a8b",
18-
"@code-hike/code-diff": "0.0.0-4333a8b",
10+
"@code-hike/mini-browser": "0.3.0-next.0",
11+
"@code-hike/mini-frame": "0.3.0-next.0",
12+
"@code-hike/mini-terminal": "0.3.0-next.0",
13+
"@code-hike/player": "0.3.0-next.0",
14+
"@code-hike/scroller": "0.3.0-next.0",
15+
"@code-hike/scrollycoding": "0.3.0-next.0",
16+
"@code-hike/sim-user": "0.3.0-next.0",
17+
"@code-hike/smooth-column": "0.3.0-next.0",
18+
"@code-hike/smooth-lines": "0.3.0-next.0",
19+
"@code-hike/code-diff": "0.3.0-next.0",
1920
"@storybook/addon-actions": "^6.0.26",
2021
"@storybook/addon-controls": "^6.0.26",
2122
"@storybook/addon-docs": "^6.0.26",

packages/storybook/src/mini-editor.story.js

+57
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,63 @@ function CodeSandboxIcon() {
280280
)
281281
}
282282

283+
export const manyTabs = () => {
284+
return (
285+
<Page>
286+
<h2>Three tabs</h2>
287+
<MiniEditor
288+
style={{ height: 200 }}
289+
lang="js"
290+
file="index.js"
291+
steps={[{ code: code1 }]}
292+
progress={0}
293+
tabs={["index.js", "two.css", "three.html"]}
294+
/>
295+
<h2>With button</h2>
296+
<MiniEditor
297+
style={{ height: 200 }}
298+
lang="js"
299+
file="index.js"
300+
steps={[{ code: code1 }]}
301+
progress={0}
302+
tabs={["index.js", "two.css", "three.html"]}
303+
button={<CodeSandboxIcon />}
304+
/>
305+
<h2>Long name</h2>
306+
<MiniEditor
307+
style={{ height: 200 }}
308+
lang="js"
309+
file="index-with-long-name.js"
310+
steps={[{ code: code1 }]}
311+
progress={0}
312+
tabs={[
313+
"index-with-long-name.js",
314+
"two.css",
315+
"three.html",
316+
]}
317+
button={<CodeSandboxIcon />}
318+
/>
319+
<h2>Six tabs</h2>
320+
<MiniEditor
321+
style={{ height: 200 }}
322+
lang="js"
323+
file="two.js"
324+
steps={[{ code: code1 }]}
325+
progress={0}
326+
tabs={[
327+
"index.js",
328+
"two.js",
329+
"three.html",
330+
"four.js",
331+
"five.css",
332+
"six.html",
333+
]}
334+
button={<CodeSandboxIcon />}
335+
/>
336+
</Page>
337+
)
338+
}
339+
283340
export const x = () => {
284341
return (
285342
<WithProgress length={xprops.steps.length}>

0 commit comments

Comments
 (0)