Coder Social home page Coder Social logo

Comments (11)

nickmccurdy avatar nickmccurdy commented on May 19, 2024 3

As far as UI is concerned, I really like how Code Sandbox does it. There's a preference pane with a GUI for the Prettier fields and a link to edit the JSON directly for importing/exporting (similar vibe to VSCode's user/workspace settings).

image
image

Source: https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/app/pages/common/Modals/PreferencesModal/CodeFormatting/Prettier/index.tsx

from prettier-browser-extension.

kaicataldo avatar kaicataldo commented on May 19, 2024

Definitely think we should implement this! Assuming we want this in the extension's settings page, seems like we could:

  1. Have a text input that accepts JSON
  2. Have individual inputs for each configurable option (I think VS Code's plugin does this?)
  3. Both of the above!

from prettier-browser-extension.

kaicataldo avatar kaicataldo commented on May 19, 2024

That seems pretty ideal to me.

from prettier-browser-extension.

nickmccurdy avatar nickmccurdy commented on May 19, 2024

Would you be okay with pulling in React for this? It will require some build configuration which I can help with, but it's pretty small and will make managing the form a lot easier. Code Sandbox is also using React, but I'm not sure how reusable their components in the source would be.

from prettier-browser-extension.

kaicataldo avatar kaicataldo commented on May 19, 2024

I'm not opposed to that at all! The current plugin code uses vanilla JS because there really isn't much UI to render.

from prettier-browser-extension.

lipis avatar lipis commented on May 19, 2024

Yes, I also don't mind React.. as long as it's nice and tidy..! :)

from prettier-browser-extension.

nickmccurdy avatar nickmccurdy commented on May 19, 2024

I just realized the playground is using React, would it be better to try to reuse those components instead of cloning Code Sandbox's UI? It has sections and I figure it might be more familiar to Prettier users, though I think Code Sandbox's looks nicer.

Code reuse would be a little tricky at first with this being a separate repository from Prettier and the playground, but we could release a package for both in theory.

from prettier-browser-extension.

kaicataldo avatar kaicataldo commented on May 19, 2024

Oh, that's interesting. It looks like there are a number of configuration options in the playground that we probably wouldn't use. I wonder if it's worth the overhead of extracting out a package that we have to make sure works for both cases? Given that there isn't a ton of complex behavior, I'm inclined to say we just write our out config UI. I'm happy to go with consensus on this though :)

from prettier-browser-extension.

nickmccurdy avatar nickmccurdy commented on May 19, 2024

We could start by copying it if we like the playground UI, and extract a package if we end up using shared logic. Do you have any preference over this UI or the code sandbox one? Or do you have a different idea?

from prettier-browser-extension.

kaicataldo avatar kaicataldo commented on May 19, 2024

I think that seems like a good plan! I didn't have any particular design choices in mind. I like the idea of making it an embedded option, because then you can just style the popup and not have to worry about how it looks in a full document. I think the Redux DevTools use this nicely:

Screen Shot 2019-10-17 at 9 32 30 PM

Screen Shot 2019-10-17 at 9 32 36 PM

from prettier-browser-extension.

nickmccurdy avatar nickmccurdy commented on May 19, 2024

That's a good idea, I think it would make formatting easier.

from prettier-browser-extension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.