elcritch

elcritch

Update Aug 2024:

I’ve been working on re-writing my previous bulma widgets library to modernize it. There’s basic components for most of the basic bulma elements. There are also a few initial stateful live components for dropdowns and menus.

The library also includes the necessary Bulma CSS files for easy setup.

A big part of the re-write focuses on changing how the state of widgets is handled. There’s an event system which provides out-of-the-box support for updating shared values from a parent liveview in child live components. There’s also support for cached values and broadcasting values. I’m still working on documenting the design, but the api’s in what I think is a useable state.

The goal is easy development for small scale app style UIs for Nerves devices.

https://github.com/elcritch/bulma_widgets2/

Here’s the examples I’ve been developing with:

https://github.com/elcritch/bulma_widgets2/blob/main/lib/bulma_widgets_web/live/widget_examples_live.ex


Original (Mar 2020):

BulmaWidgets – LiveComponent wrappers around Bulma CSS “widgets” for Phoenix LiveView. This library is intended to wrap the Bulma elements/components into mostly self-contained components. These components help make developing interactive UI’s in LiveView simpler.

Code is on Github at Bulma Widgets. An example server is running at http://lacritch.xyz/.

This is an early release being porting from an earlier internal pre-live-component UI library. I’d appreciate any feedback, ideas on implementing the component interactions with the parent LiveView. There is a little bit of interaction between the parent LiveView and the components, but it’s very minimal.

Currently only two elements have been ported, but show the overall usage. Future elements will be mostly focused on inputs / user selections useful for allowing users to select options or user components (such as tabs). Providing wrappers for elements like Cards requires a lot of API options, and so may not fit well into this library.

While this library is similar to Surface it’s much less ambitious in scope… I’d recommend Surface for those who want a full featured component library. This library focus’s on providing basic LiveView-only UI components without needing a separate template engine or tooling.

Showing Posts 1 to 10

elcritch

elcritch OP

An interesting note on the lacritch.xyz server is that it’s using Nerves to build and deploy to a small Linux VPS. It currently takes ~5 seconds to come back up after rebooting. It doesn’t have a proxy in front, so if anyone any security issues I’d love to know!

qhwa

qhwa

Interesting project. I like Bulma too.
I happen to develop a toy website (source code) with Phoenix LiveView and Bulma. Will definitely give your library a try soon.

Also, I’m super curious about the use case of Nerves here. As I know Nerves packs applications, ERTs and a small Linux system together into a small system image, if I am not wrong. So how do you deploy the combined system to your VPS?

ondrej-tucek

ondrej-tucek

Hey @elcritch this is very cool project :slight_smile: We also like and use Bulma for our projects, for example see our app (still WIP). It’s all written in LiveView.

Did you consider about how change a css style or a html content in your components for different using? I mean, e.g. a few modal window, one for showing danger action (see our modal in app), one for showing warning (different style and data), etc. But it’s only one component (as you can see in our component modal).

elcritch

elcritch OP

Oh yes, that’s correct. Nerves builds a firmware image with the system and code that can be uploaded via an Upload script by ./upload.sh lacritch.xyz. Easy as can be. The code for this server is on my GitHub at Cloud Server. I should probably fix the Phoenix signing keys so they’re not in the config.exs but this is a throw-away server so I made it public so you could see it. The whole process is programmable in a few dozen lines of Elixir as well. Bootstrapping the initial VPS image is a little fiddly but not too bad. I used a Knoppix image to write the initial Nerves firmware to a VPS disk and it worked like a charm.

Another note is that I don’t see why one couldn’t take a Nerves firmware image and create a container image by dumping the squashfs filesystem to a tarball. Then you don’t need to worry about library version compatibility since it’s all cross-compiled. :slight_smile: There’s more discussion on the topic Can you use nerves to deploy a cloud-based server? - #12 by axelson and Running Nerves on Amazon EC2

Honestly, when/if my company needs to deploy web services I’m going to use Nerves images. I don’t see the need for K8s unless you’re doing microservices and I plan to do everything in Elixir. Maybe make a nice LiveView dashboard, insta k8s alternative. :wink:

elcritch

elcritch OP

Great! It would be good to get feedback from people. Your app looks nice, and it’s a nice complete looking setup for people to look at! Looks like you’re using POW which I haven’t tried yet.

Nice! Mind if I copy some of your components? I did a little HTML content in the tab’s component using a do block which works nicely, but that doesn’t scale to lots of components. There’s only two components currently, but the hardest part was just getting plumbing together. I’m not sure if how I’m handling the update/2 functions is the best, but it’s working.

The biggest issue in these component libraries is how to make a usable API for the more complex elements. That and it’d be nice to have a similar library for bootstrap, etc. Still having all the widgets connected so that clicking a another UI widget closes an already open dropdown. Otherwise it feels clunky and coding those interactions up is tedious.

elcritch

elcritch OP

P.S. one thing I forgot to note, it that on iOS/embedded touchscreens many buttons don’t work with LiveView. I’ve got some JS code that fixes it by appending event handlers for touch. Just FYI, I had trouble using both of your sites on my iPhone.

qhwa

qhwa

Oh you’re doing really cool things and inspired me a lot.

Really? which part of it? I thought it was working well because on my iPhone it seems good.

elcritch

elcritch OP

Nifty!

I might’ve got the two sites mixed up. I thought you’d posted a link to your site too?

P.S. I also added Modal Component. I’m curious if the API makes sense to others!

Menkir

Menkir

Cool project. I am currently working with LiveComponents and Bulma myself. I wrote generic Bulma widgets to reuse them. Are you also planning to integrate the additional Bulma extensions on wikiki?

ondrej-tucek

ondrej-tucek

Don’t mind, it’s use to free. If I understand it correctly your Bulma Widgets behave as the source of truth, right? Maybe that’s the reason why is a composition of components so complicated. Just an idea, instead of using update function, define for each component a couple functions like handle_event/handle_info/.. which would provide a communication between these components.

Yes, I agree. The API should follow the KISS rule.

I had trouble using both of your sites on my iPhone.

We didn’t want to build this app for mobile devices. It’s only for desktop using :slight_smile: But it’s good to know, thx.

Where Next? Top

Trending in Announcing Top

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
pferriby
Introductory paragraph I’ll be looking for a keen junior or someone that has a couple of years experience in the real world (so you’ve be...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews