Skip to content

Commit

Permalink
Merge pull request #22 from agneym/15-react-tab-css
Browse files Browse the repository at this point in the history
15 react tab css
  • Loading branch information
agneym authored Mar 16, 2021
2 parents 6695612 + d71092b commit 3ff508a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ yarn add @agney/playground

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

const App = () => {
const snippet = {
Expand Down Expand Up @@ -97,6 +99,12 @@ https://blog.agney.dev/introducing-playground/
}
```

### Why is there a @react/tabs import?

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.

_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._

### How does module imports work?

If an NPM package exposes an endpoint for "module", then you can direcly import this package by it's name.
Expand Down
3 changes: 2 additions & 1 deletion example/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Fragment } from "react";
import React from "react";
import { render } from "react-dom";
import "babel-polyfill";
import "@reach/tabs/styles.css";
import Playground from "@agney/playground";

const App = () => {
Expand Down
22 changes: 11 additions & 11 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,24 @@
"playground"
],
"files": [
"src",
"dist"
"dist",
"README.md"
],
"author": "Agney Menon <[email protected]> (@agneymenon)",
"license": "MIT",
"peerDependencies": {
"react": ">=16",
"react-dom": ">=16"
},
"dependencies": {
"@agney/react-inspector": "^4.0.0",
"@reach/auto-id": "^0.13.2",
"@reach/tabs": "^0.13.2",
"goober": "^2.0.33",
"lodash.merge": "^4.6.2",
"prism-react-renderer": "^1.2.0",
"react-simple-code-editor": "^0.11.0"
},
"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.13.10",
Expand All @@ -52,15 +61,6 @@
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"dependencies": {
"@agney/react-inspector": "^4.0.0",
"@reach/auto-id": "^0.13.2",
"@reach/tabs": "^0.13.2",
"goober": "^2.0.33",
"lodash.merge": "^4.6.2",
"prism-react-renderer": "^1.2.0",
"react-simple-code-editor": "^0.11.0"
},
"jest": {
"rootDir": "src"
},
Expand Down
2 changes: 0 additions & 2 deletions playground/src/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React, { FC, useState, createElement } from "react";
import { useId } from "@reach/auto-id";
import { styled, setup, DefaultTheme } from "goober";

import "@reach/tabs/styles.css";

import Editor from "./Editor";
import Result from "./Result";
import { ISnippet, IEditorTabs, IResultTabs } from "./types";
Expand Down

0 comments on commit 3ff508a

Please sign in to comment.