mafinar

mafinar

Just tried Surface component library for LiveView and it's amazing

Wanted to try out Surface for awhile now and yesterday finally had the time for it, the developer experience is amazing and I decided to convert the project (a small one) to Surface. I would like to know if any of you have any experience with it or if there’s anything I’d look out for.

If anyone’s interested in the project, it’s here (It’s a Covid19 dashboard based on (soon to be pluggable) John Hopkins Dataset.

Most Liked

mafinar

mafinar

I demoed it on ElixirTO last month, the video just got uploaded, here is the link on it.

mafinar

mafinar

asdf is fun!

So the experience is very good. I had ~12 components and 2 live views written in plain LV and took around 2 hours convert 5 of them to Surface until I hit a bit of a block with passing Jason encoded data for the Leaflet Map hook to consume. I realized it’s probably a bug, reported it and went to sleep, only to see it fixed upon waking up, and completed the transformation without any hiccups. My muscle memory is much more attuned to this syntax as opposed to LV one (after all, it IS a wrapper so it’s meant to be friendlier ;)).

Now for the things I loved about it:

  • Syntax is reminiscent of Vue, did not have to stress much to understand how to do what.
  • The distinction between LiveView, LiveComponent and Component is nice and explicit
  • Awesome declarative is awesome! I get warnings and errors on mismatched prop types (for some of the types at least). I even get warnings if I feed something to a component I did not declare (i.e. id in a Surface.Component (stateless) and not declaring it).
  • Event handling niceties. Events are types too, declarable! Not remembering to @myself was convenient for me. Also :on-click is more intuitive than phx-click (on any other even).
  • The IDE integration is surprisingly good (I was expecting worse) and there is a to do list on it I look forward too
  • There is a Context
  • For me, <Hello name={{ @name }} /> is better than <%= live_component @socket, Hello, name: @name %> and <tr :for={{ row <- rows}}></tr> is better than <tr><%= for row <- rows %>{}<% end %></tr>
  • Bulma for examples! So there was this great minds think alike effect

I am still working with it as I type this (which explains the lengthy reply), I cheated on some of the components with :any as prop/data type so am fixing those and thinking of converting some of the form and input elements with Surface components. I hope to make the codebase look prettier by tomorrow and then move back to the backend. If you try it out and have any suggestions please reach out!

Carter

Carter

Looks v.cool Mafinar…but could you upload a demo to Heroku for those of us who dont have elixir dev environments pls?

Where Next?

Popular Frontend topics Top

wolf4earth
I’m currently in the process of rebuilding my personal website/blog from scratch. At the moment my website is using hugo, and while I thi...
New
AstonJ
Another WebAssembly Frontend Framework for Rust :nerd_face: Seed is a frontend Rust framework for creating fast and reliable web apps w...
New
First poster: bot
SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. ...
New
First poster: bot
HTML Boilerplate is the gold standard of HTML base templates but I’ve always wanted something simpler. We don’t need to force decisions ...
New
CommunityNews
Tailwind CSS Tools For Developers. A collection of tools designed for developers, to save you and your team time when building websites w...
New
First poster: bot
Kaboom!!. a fun JavaScript game programming library &amp; environment https://replit.com/kaboom This thread was posted by one of our ...
New
First poster: bot
Explore DOM Events. Learn how the DOM Event system works through exploration
New
First poster: AstonJ
Try it here: https://david.li/paint/ This thread was posted by one of our members via one of our news source trackers.
New
First poster: bot
RacketScript is an experimental lightweight Racket to JavaScript (ECMAScript 6) compiler. RacketScript aims to leverage both JavaScript a...
New
CommunityNews
Announcing Parcel CSS: A new CSS parser, compiler, and minifier written in Rust!. I’m very excited to announce @parcel/css, a new CSS pa...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New