-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next: Plan future API #89
Comments
@kitten @sofiapoh This looks great! A few questions and comments though:
These are some things that first come to mind (I'll let you know if I can think of anything else). I know this is a draft but think it might be nice to clarify what the PropType of each prop is and go into more detail on what the behavior of each of this prop is, similar to the table in the react-live README. I am very excited for this, let me know if there's any other way I can help, happy to help writing code and/or docs 😄 |
@alejandrogarciasalas These are some great questions :) Let me try to go through them one by one
Hope this answers everything :) tl;dr Take a look at prism-react-renderer and react-simple-code-editor to get an idea of the future Editor component, which are both published and ready for prod use today individually :) https://github.com/FormidableLabs/prism-react-renderer |
Regarding Bable/Babel. If Buble isn't swapped out then it probably makes sense to contribute back to it on a few key tickets that follow some pretty commonly used features in the react/babel community that don't currently work in react-live: |
One feedback regarding the API, |
I would like to be able have editors not map 1:1 onto previews. E.g. have one editor and multiple previews. The editor shows the code for the most recently clicked preview. That way code can be shown in another pane (e.g. storybook) without needing loads of providers . The code in the code pane may change depending on scroll position, focus or button press. function ThreePreviewsOneEditor() {
const [activeId, setActive] = useState("a")
return <LiveProvider>
<Live.Code id="a" code="<div>A</div>" /> /* render null*/
<Live.Code id="b" code="<div>B</div>" />
<Live.Code id="c" code="<div>C</div>" />
<Live.Editor fileName={activeId} />
<Live.Preview activeId="a" onFocus={() => setActive("a")} />
<Live.Preview activeId="b" onFocus={() => setActive("b")} />
<Live.Preview activeId="c" onFocus={() => setActive("c")} />
</LiveProvider>
} |
+1 for TypeScript support! I can't use this project currently but I so wish I could. |
Perfect-world-wishful-thinking-optimal-API:
The text was updated successfully, but these errors were encountered: