devnacho / mountain_view

Living styleguide for Rails
MIT License
273 stars 29 forks source link

Order of the components in sidebar #60

Closed Spone closed 7 years ago

Spone commented 7 years ago

Hello there,

I can't figure out why my components are not displayed in alphabetical order in my styleguide sidebar. Is there a way to force this (without adding some specific logic in my layout)?

image

I think it should be the default, what do you think?

Thanks

Spone commented 7 years ago

I mean, I can have this in my layout:

mv_components.sort_by(&:name).each do |component|

But if you think it should be the default, I'd be happy to prepare a PR for this.

kitop commented 7 years ago

Great point @Spone! Yeah, it should definitively be the default.

I'll push the change and release a patch version in a bit.

Thanks for the input!!

kitop commented 7 years ago

Just out of curiosity, in what OS and ruby version are you noticing this?

Spone commented 7 years ago

Ubuntu 16.04 LTS, Ruby 2.4.1 (yeah it's pretty weird that the file system returns them in this order)

Spone commented 7 years ago

Also, it's a detail but I think you should consider using:

link_to_unless_current component.title, styleguide_path(id: component.name)

instead of

link_to component.title, styleguide_path(id: component.name)

So the current component is shown differently.

kitop commented 7 years ago

@Spone that's a good point to! Will update and release in the same version bump :)

kitop commented 7 years ago

Changes released in v0.12.3 🎉

Thanks for your help and input @Spone!!