komposable / komponent

An opinionated way of organizing front-end code in Ruby on Rails, based on components
http://komponent.io
MIT License
427 stars 31 forks source link

Styleguide #95

Closed nicolas-brousse closed 5 years ago

nicolas-brousse commented 6 years ago

A really work in progress about adding style guide view.

Closes #94.

nicolas-brousse commented 6 years ago

@florentferry, @Spone, Some questions:

Spone commented 6 years ago

For now, let's not add extra pages. For the assets, can we have a dedicated pack?

We could also have components styleguide/header and styleguide/footer in the engine, that you can override in your project if you want to customize them.

nicolas-brousse commented 6 years ago

For the assets, can we have a dedicated pack?

Not sure this part is easy to do. For now I just put style inside a style tag.

Otherwise I:

I will continue this later, may be in the next week.

nicolas-brousse commented 6 years ago

I was thinking a bit about assets this last days and I notice two problems:

  1. Not sure if we can easily create a pack, I have to read more about webpacker.
  2. Not sure how could we process to load the css of the component. MountainView did it from sprockets, but we can't really do the same since Komponent use webpacker.
Spone commented 6 years ago

I worked on the default UI today. Here is what it looks like:

screen shot 2018-06-09 at 16 19 03

We discussed the next steps with @nicolas-brousse.

The idea to allow customization of the styleguide, and easy setup, is to:

This way, the user can customize the UI of the styleguide, by modifying components and reusing CSS variables from the main app. It's also possible to add JavaScript in those components, if needed. The assets are compiled using webpacker, with the same process as the main app existing pack.

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 709


Totals Coverage Status
Change from base Build 699: 0.2%
Covered Lines: 180
Relevant Lines: 181

💛 - Coveralls
nicolas-brousse commented 6 years ago

I made some changes:

What needs to be done:

What I noticed:

Spone commented 6 years ago

Thanks for the progress!

Decide to use Engine or Railtie or both

Can you explain?

Design seems to be broken in Firefox, not sure if I broke something with my lasts commits.

Do you have a screenshot?

Spone commented 6 years ago

@nicolas-brousse I added more tests, we're now back over 98% coverage. What's left to test is:


About Railtie vs. Engine:.

Any Rails::Engine is also a Rails::Railtie

Source: https://api.rubyonrails.org/classes/Rails/Engine.html

So I don't see any issue in using an Engine :)

nicolas-brousse commented 6 years ago

About Railtie vs. Engine:

Okay. It was just to be sure with you and have your advice if needed.

Spone commented 6 years ago

Here are a few more tasks:

nicolas-brousse commented 6 years ago

I created #114 to do "support for adding static pages: add routes in the engine, so you just have to create the views in app/views/komponent/static/" in a separate PR