-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort sidebar entries #517
Comments
Hello again! So my company very much wants this. If you're open to me taking it on, I've been given the go ahead to do this on the clock. Do you have an API in mind? My thinking was to add a callback to
You could do: # _root.index.exs
def order do
[
:menu,
buttons: [
:submit,
:button
]
]
end or: # _root.index.exs
def order, do: [:menu, :buttons]
# _buttons.index.exs
def order, do: [:submit, :button] Another idea would be to add "weights" to the stories themselves. This option feels harder to maintain, although it could be useful if you always want to sort one story to the top (like a summary/usage page) and have everything else alphabetical. Lastly, I'm not sure if anyone wants this (I don't think we do) but it would be to define a sort function: def sort_function, do: &MyApp.sort_function/2 Of course all three could be implemented. What are your thoughts? |
What about
defmodule Storybook.CoreComponents do
use PhoenixStorybook.Index
def folder_open?, do: true
def folder_icon, do: {:fa, "box-open", :thin}
def folder_index, do: 0
def entry("back"), do: [icon: {:fa, "circle-left", :thin}, index: 0]
def entry("button"), do: [icon: {:fa, "rectangle-ad", :thin}, index: 1]
def entry("error"), do: [icon: {:fa, "circle-exclamation", :thin}, index: 2]
def entry("flash"), do: [icon: {:fa, "bolt", :thin}]
end WDYT? |
Oh ya, I totally forgot about |
Let me know if you would like me to handle this. If so, I can get started tomorrow. |
Yes please! |
All entries are currently sorted alphabetically.
We should implement manual sorting, such as custom indexes or a similar method.
The text was updated successfully, but these errors were encountered: