UNPKG

3.66 kBMarkdownView Raw
1# code<sup>_lift_</sup>
2
3> A "No Code" GUI for your existing React app.
4>
5> ![Next.js Example](/screenshot.png)
6> – [Launch Tweet](https://twitter.com/ericclemmons/status/1205161643300098048)
7
8## Getting Started
9
10Within your project:
11
121. `yarn add codelift --dev`
131. For [create-react-app][cra]:
14
15 `yarn codelift start`
16
17 For [Next.js][next]:
18
19 `yarn codelift dev`
20
21 _(`codelift` runs `yarn ____` with whatever you provide)_
22
231. Add the following `import "codelift/register"` to the top of your `src/index.tsx` or `pages/_app.tsx`:
24
25 ```js
26 import React from "react";
27 import ReactDOM from "react-dom";
28
29 import { register } from "codelift";
30 register({ React, ReactDOM });
31 ```
32
33 _`codelift` requires access to your application's copy of `react` and `react-dom` to support custom inspectors._
34
35## Examples
36
37- [Create React App + Tailwind CSS](/examples/cra)
38- [Next.js + Tailwind CSS](examples/next)
39
40## Features
41
42- <kbd>Double-Click</kbd> componetns & elements in the tree view to open in VS Code.
43
44- [Tailwind](https://tailwindcss.com/) Visual Inspector
45
46 1. Hover & Select an element.
47 1. **Find-as-you-type** CSS classes.
48 1. **Hover to preview** before applying.
49 1. **Click to toggle** in your source code.
50
51- <kbd>CMD+'</kbd> to toggle _codelift_ and browse normally.
52
53- Custom Inspectors:
54
55 Suppose you have [`Header` component](examples/next/components/Header.tsx) that accepts a `title`:
56
57 ```js
58 export const Header = ({ title }) => {
59 ...
60 }
61 ```
62
63 Next, attach a custom `Inspector` component to your `Header` that accepts the current `props` and calls `setProps` when it changes:
64
65 ```js
66 Header.Inspector = ({ props, setProps }) => {
67 return (
68 <input
69 onChange={event => setProps({ title: event.target.value })}
70 defaultValue={props.title}
71 />
72 );
73 };
74 ```
75
76 Your `Inspector` will be rendered in a sidepanel when a `Header` is selected:
77
78 > ![Header Inspector](/header.inspector.png)
79
80* [What feature would you like to see?](https://github.com/ericclemmons/codelift/issues/new)
81
82## Contributing
83
841. Clone this repo.
851. `yarn cra` or `yarn next` to run the CRA or Next.js examples, respectively.
86
87## Author
88
89- Eric Clemmons
90
91[cra]: https://github.com/facebook/create-react-app
92[next]: https://github.com/zeit/next.js/
93[tailwind]: https://tailwindcss.com/
94
95## Contributors ✨
96
97Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
98
99<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
100<!-- prettier-ignore-start -->
101<!-- markdownlint-disable -->
102<table>
103 <tr>
104 <td align="center"><a href="https://ericclemmons.com/"><img src="https://avatars0.githubusercontent.com/u/15182?v=4" width="50px;" alt=""/><br /><sub><b>Eric Clemmons</b></sub></a><br /><a href="https://github.com/ericclemmons/codelift/commits?author=ericclemmons" title="Code">💻</a> <a href="https://github.com/ericclemmons/codelift/commits?author=ericclemmons" title="Documentation">📖</a> <a href="#infra-ericclemmons" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
105 <td align="center"><a href="https://aulisi.us"><img src="https://avatars2.githubusercontent.com/u/6629172?v=4" width="50px;" alt=""/><br /><sub><b>​Faizaan</b></sub></a><br /><a href="https://github.com/ericclemmons/codelift/commits?author=aulisius" title="Code">💻</a></td>
106 </tr>
107</table>
108
109<!-- markdownlint-enable -->
110<!-- prettier-ignore-end -->
111
112<!-- ALL-CONTRIBUTORS-LIST:END -->
113
114This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
115
\No newline at end of file