Skip to content

Commit

Permalink
Update document
Browse files Browse the repository at this point in the history
- Update post install message
- Update readme to explain the different between init modes.
  • Loading branch information
bluzky committed Nov 6, 2024
1 parent 37395f1 commit 8de47ab
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@

1. **Using `salad_ui` as part of your project:**

> This way you can install only components that you want to use or you want to edit SaladUI's component source code to fit your need.
> If you just want to use SaladUI's components, see **Using as library** below.
- Adding `salad_ui` to your list of dependencies in `mix.exs`:

```elixir
Expand Down Expand Up @@ -67,6 +70,20 @@ end
#> mix salad.init --as-lib
```

- Using in your project
```
defmodule MyModule do
# import any component you need
import SaladUI.Button
def render(_) do
~H"""
<.button>Click me</.button>
"""
end
end
```


## More configuration
1. Custom error translate function
Expand Down Expand Up @@ -102,7 +119,7 @@ To run the failing tests only, just run `mix test.watch --stale`.

- ✅ Accordion
- ✅ Alert
- 🚧 Alert Dialog
- Alert Dialog
- ✅ Avatar
- ✅ Badge
- ✅ Breadcrumb
Expand All @@ -111,7 +128,7 @@ To run the failing tests only, just run `mix test.watch --stale`.
- [ ] Carousel
- ✅ Chart
- ✅ Checkbox
- 🚧 Collapsible
- Collapsible
- [ ] Combobox
- [ ] Command
- [ ] Context Menu
Expand Down
6 changes: 5 additions & 1 deletion lib/mix/tasks/salad.init.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ defmodule Mix.Tasks.Salad.Init do
:ok <- maybe_write_helpers_module(component_path, app_name, opts),
:ok <- maybe_write_component_module(component_path, app_name, opts),
:ok <- install_node_dependencies(node_opts) do
Mix.shell().info("Done. Now you can add components by running mix salad.add <component_name>")
if opts[:as_lib] do
Mix.shell().info("Done. Now you can use any component by importSaladUI.<ComponentName> in your project.")
else
Mix.shell().info("Done. Now you can add components by running mix salad.add <component_name>")
end
else
{:error, reason} -> Mix.shell().error("Error during setup: #{reason}")
end
Expand Down

0 comments on commit 8de47ab

Please sign in to comment.