Skip to content

Commit 3ff508a

Browse files
authored
Merge pull request #22 from agneym/15-react-tab-css
15 react tab css
2 parents 6695612 + d71092b commit 3ff508a

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ yarn add @agney/playground
3333

3434
```jsx
3535
import Playground from "@agney/playground";
36+
/* Why is there a tabs import? https://github.com/agneym/playground#why-is-there-a-reacttabs-import*/
37+
import "@reach/tabs/styles.css";
3638

3739
const App = () => {
3840
const snippet = {
@@ -97,6 +99,12 @@ https://blog.agney.dev/introducing-playground/
9799
}
98100
```
99101

102+
### Why is there a @react/tabs import?
103+
104+
Playground uses [`@reach/tabs`](https://reach.tech/tabs/) as a dependency. We could bundle the stylesheet or inject it inline on runtime. But both those options add unnecessary code if you are already using it.
105+
106+
_This might cause breaking changes if you have a different version of `@reach/tabs` but then I'm just expecting it to be stable along the road._
107+
100108
### How does module imports work?
101109

102110
If an NPM package exposes an endpoint for "module", then you can direcly import this package by it's name.

example/src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React, { Fragment } from "react";
1+
import React from "react";
22
import { render } from "react-dom";
33
import "babel-polyfill";
4+
import "@reach/tabs/styles.css";
45
import Playground from "@agney/playground";
56

67
const App = () => {

playground/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,24 @@
2424
"playground"
2525
],
2626
"files": [
27-
"src",
28-
"dist"
27+
"dist",
28+
"README.md"
2929
],
3030
"author": "Agney Menon <agney@outlook.in> (@agneymenon)",
3131
"license": "MIT",
3232
"peerDependencies": {
3333
"react": ">=16",
3434
"react-dom": ">=16"
3535
},
36+
"dependencies": {
37+
"@agney/react-inspector": "^4.0.0",
38+
"@reach/auto-id": "^0.13.2",
39+
"@reach/tabs": "^0.13.2",
40+
"goober": "^2.0.33",
41+
"lodash.merge": "^4.6.2",
42+
"prism-react-renderer": "^1.2.0",
43+
"react-simple-code-editor": "^0.11.0"
44+
},
3645
"devDependencies": {
3746
"@babel/core": "^7.13.10",
3847
"@babel/preset-env": "^7.13.10",
@@ -52,15 +61,6 @@
5261
"react": "^17.0.1",
5362
"react-dom": "^17.0.1"
5463
},
55-
"dependencies": {
56-
"@agney/react-inspector": "^4.0.0",
57-
"@reach/auto-id": "^0.13.2",
58-
"@reach/tabs": "^0.13.2",
59-
"goober": "^2.0.33",
60-
"lodash.merge": "^4.6.2",
61-
"prism-react-renderer": "^1.2.0",
62-
"react-simple-code-editor": "^0.11.0"
63-
},
6464
"jest": {
6565
"rootDir": "src"
6666
},

playground/src/Playground.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React, { FC, useState, createElement } from "react";
22
import { useId } from "@reach/auto-id";
33
import { styled, setup, DefaultTheme } from "goober";
44

5-
import "@reach/tabs/styles.css";
6-
75
import Editor from "./Editor";
86
import Result from "./Result";
97
import { ISnippet, IEditorTabs, IResultTabs } from "./types";

0 commit comments

Comments
 (0)