Skip to content

Commit

Permalink
renamed project to phoenix_storybook 🔥
Browse files Browse the repository at this point in the history
  • Loading branch information
cblavier committed Feb 14, 2023
1 parent f5c9dea commit 1b1b3c7
Show file tree
Hide file tree
Showing 146 changed files with 507 additions and 506 deletions.
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
inputs: [
"*.{ex,exs}",
"{config,lib,priv}/**/*.{ex,exs,eex}",
"test/phx_live_storybook/**/*.{ex,exs}",
"test/phoenix_storybook/**/*.{ex,exs}",
"test/*.{ex,exs}"
]
]
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ erl_crash.dump
*.ez

# Ignore package tarball (built via "mix hex.build").
phx_live_storybook-*.tar
phoenix_storybook-*.tar

/priv/static/**/*.gz
/priv/static/**/*-????????????????????????????????.*
Expand Down
39 changes: 20 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

## v0.5.0 (not yet released)

- **change (breaking!)**: [component description is no longer a function defined](https://github.com/phenixdigital/phx_live_storybook/issues/138)
- **change (breaking!)**: project has been renamed from `phx_live_storybook` to `phoenix_storybook`!
- **change (breaking!)**: [component description is no longer a function defined](https://github.com/phenixdigital/phoenix_storybook/issues/138)
in your story file but is fetched from your component `@doc` or your live_component `@moduledoc`
comments.
- **feature**: [support for Example stories](https://github.com/phenixdigital/phx_live_storybook/issues/213)
- **feature**: [visual regression endpoints](https://github.com/phenixdigital/phx_live_storybook/issues/215).
- **feature**: [support for Example stories](https://github.com/phenixdigital/phoenix_storybook/issues/213)
- **feature**: [visual regression endpoints](https://github.com/phenixdigital/phoenix_storybook/issues/215).
This endpoint can output bare components without the storybook's UI so that you can automate
visual tests screenshots.
- **improvement**: [mix phx.gen.storybook now prints formatter instructions](https://github.com/phenixdigital/phx_live_storybook/issues/153)
- **improvement**: [new theme strategies](https://github.com/phenixdigital/phx_live_storybook/issues/177). Theming guide has been updated.
- **improvement**: [boolean attributes are rendered with their shorthand notation](https://github.com/phenixdigital/phx_live_storybook/issues/169)
- **improvement**: [generating stories for Phoenix 1.7 core components](https://github.com/phenixdigital/phx_live_storybook/issues/187)
- **bugfix**: [a project without heroicons will no longer raise on the generated icon story](https://github.com/phenixdigital/phx_live_storybook/issues/152)
- **bugfix**: [fixed variation crash with a large binary in a map](https://github.com/phenixdigital/phx_live_storybook/pull/161)
- **bugfix**: [fixed slots crash if rendered more than once ](https://github.com/phenixdigital/phx_live_storybook/issues/206)
- **improvement**: [mix phx.gen.storybook now prints formatter instructions](https://github.com/phenixdigital/phoenix_storybook/issues/153)
- **improvement**: [new theme strategies](https://github.com/phenixdigital/phoenix_storybook/issues/177). Theming guide has been updated.
- **improvement**: [boolean attributes are rendered with their shorthand notation](https://github.com/phenixdigital/phoenix_storybook/issues/169)
- **improvement**: [generating stories for Phoenix 1.7 core components](https://github.com/phenixdigital/phoenix_storybook/issues/187)
- **bugfix**: [a project without heroicons will no longer raise on the generated icon story](https://github.com/phenixdigital/phoenix_storybook/issues/152)
- **bugfix**: [fixed variation crash with a large binary in a map](https://github.com/phenixdigital/phoenix_storybook/pull/161)
- **bugfix**: [fixed slots crash if rendered more than once ](https://github.com/phenixdigital/phoenix_storybook/issues/206)

## v0.4.5 (2022-10-10)

Expand All @@ -24,16 +25,16 @@

## v0.4.4 (2022-10-10)

- **feature**: [you can now customize your story div container](https://github.com/phenixdigital/phx_live_storybook/issues/135)
- **improvement**: [removed routes helpers](https://github.com/phenixdigital/phx_live_storybook/pull/137)
- **feature**: [you can now customize your story div container](https://github.com/phenixdigital/phoenix_storybook/issues/135)
- **improvement**: [removed routes helpers](https://github.com/phenixdigital/phoenix_storybook/pull/137)
(will help transition to Phoenix 1.7)
- **improvement**: [pass connect params to story page](https://github.com/phenixdigital/phx_live_storybook/pull/130)
- **bugfix**: [add :live_session and :as options to router](https://github.com/phenixdigital/phx_live_storybook/pull/127)
- **bugfix**: [missing playground tab icons](https://github.com/phenixdigital/phx_live_storybook/issues/134)
- **improvement**: [pass connect params to story page](https://github.com/phenixdigital/phoenix_storybook/pull/130)
- **bugfix**: [add :live_session and :as options to router](https://github.com/phenixdigital/phoenix_storybook/pull/127)
- **bugfix**: [missing playground tab icons](https://github.com/phenixdigital/phoenix_storybook/issues/134)

## v0.4.3 (2022-10-04)

- **bugfix**: [mounting several storybooks in router is now possible](https://github.com/phenixdigital/phx_live_storybook/issues/126)
- **bugfix**: [mounting several storybooks in router is now possible](https://github.com/phenixdigital/phoenix_storybook/issues/126)
- **bugfix**: fixed mobile layout

## v0.4.2 (2022-10-02)
Expand All @@ -43,10 +44,10 @@

## v0.4.1 (2022-09-30)

- **bugfix**: sidebar, tabs & theme icon [rendering issues have been fixed](https://github.com/phenixdigital/phx_live_storybook/issues/111). Icons are no longer rendered within the CSS sandbox and should be
- **bugfix**: sidebar, tabs & theme icon [rendering issues have been fixed](https://github.com/phenixdigital/phoenix_storybook/issues/111). Icons are no longer rendered within the CSS sandbox and should be
styles with `lsb-*` classes.
- **bugfix**: [search panel no longer binds the `/` key](https://github.com/phenixdigital/phx_live_storybook/issues/110).
- **bugfix**: [component generated by the `mix phx.gen.storybook` is no longer crashing.](https://github.com/phenixdigital/phx_live_storybook/pull/116)
- **bugfix**: [search panel no longer binds the `/` key](https://github.com/phenixdigital/phoenix_storybook/issues/110).
- **bugfix**: [component generated by the `mix phx.gen.storybook` is no longer crashing.](https://github.com/phenixdigital/phoenix_storybook/pull/116)

## v0.4.0 (2022-09-29)

Expand Down
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PhxLiveStorybook contributing guide
# PhoenixStorybook contributing guide

Please take a moment to review this document in order to make the contribution process easy and
effective for everyone involved!
Expand Down Expand Up @@ -50,7 +50,7 @@ For modules, protocols and types say what it is. For example write
something like:

```elixir
defmodule PhxLiveStorybook.Foo do
defmodule PhoenixStorybook.Foo do
@moduledoc """
Conveniences for working on Foo.
...
Expand Down Expand Up @@ -96,11 +96,11 @@ in order to craft an excellent pull request

```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/phx_live_storybook
git clone https://github.com/<your-username>/phoenix_storybook
# Navigate to the newly cloned directory
cd phx_live_storybook
cd phoenix_storybook
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/phenixdigital/phx_live_storybook
git remote add upstream https://github.com/phenixdigital/phoenix_storybook
```

2. If you cloned a while ago, get the latest changes from upstream, and update your fork:
Expand All @@ -111,14 +111,14 @@ git pull upstream main
git push
```

3. Clone phx_live_storybook_sample alongside this repository.
3. Clone phoenix_storybook_sample alongside this repository.

```bash
cd ..
git clone [email protected]:phenixdigital/phx_live_storybook_sample.git
git clone [email protected]:phenixdigital/phoenix_storybook_sample.git
```

And follow [phx_live_storybook_sample README.md](https://github.com/phenixdigital/phx_live_storybook_sample) instructions.
And follow [phoenix_storybook_sample README.md](https://github.com/phenixdigital/phoenix_storybook_sample) instructions.

4. Create a new feature branch (off of `main`) to contain your feature, change, or fix.

Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# PhxLiveStorybook
# PhoenixStorybook

[![github](https://github.com/phenixdigital/phx_live_storybook/actions/workflows/elixir.yml/badge.svg)](https://github.com/phenixdigital/phx_live_storybook/actions/workflows/elixir.yml)
[![codecov](https://codecov.io/gh/phenixdigital/phx_live_storybook/branch/main/graph/badge.svg)](https://codecov.io/gh/phenixdigital/phx_live_storybook)
[![GitHub release](https://img.shields.io/github/v/release/phenixdigital/phx_live_storybook.svg)](https://github.com/phenixdigital/phx_live_storybook/releases/)
[![github](https://github.com/phenixdigital/phoenix_storybook/actions/workflows/elixir.yml/badge.svg)](https://github.com/phenixdigital/phoenix_storybook/actions/workflows/elixir.yml)
[![codecov](https://codecov.io/gh/phenixdigital/phoenix_storybook/branch/main/graph/badge.svg)](https://codecov.io/gh/phenixdigital/phoenix_storybook)
[![GitHub release](https://img.shields.io/github/v/release/phenixdigital/phoenix_storybook.svg)](https://github.com/phenixdigital/phoenix_storybook/releases/)

📚 [Documentation](https://hexdocs.pm/phx_live_storybook)
📚 [Documentation](https://hexdocs.pm/phoenix_storybook)
&nbsp; - &nbsp;
🔎 [Demo](http://phx-live-storybook-sample.fly.dev/storybook)
&nbsp; - &nbsp;
🎓 [Sample repository](https://github.com/phenixdigital/phx_live_storybook_sample)
🎓 [Sample repository](https://github.com/phenixdigital/phoenix_storybook_sample)
&nbsp; - &nbsp;
🍿 [Getting started video](https://www.youtube.com/watch?v=MTE7dLhkQ8Q)

<!-- MDOC !-->

PhxLiveStorybook provides a [_storybook-like_](https://storybook.js.org) UI interface for your
PhoenixStorybook provides a [_storybook-like_](https://storybook.js.org) UI interface for your
Phoenix LiveView components.

- Explore all your components, and showcase them with different variations.
- Browse your component's documentation, with their supported attributes.
- Learn how components behave by using an interactive playground.

![screenshot](https://github.com/phenixdigital/phx_live_storybook/raw/main/screenshots/screenshot-01.jpg)
![screenshot](https://github.com/phenixdigital/phx_live_storybook/raw/main/screenshots/screenshot-02.jpg)
![screenshot](https://github.com/phenixdigital/phoenix_storybook/raw/main/screenshots/screenshot-01.jpg)
![screenshot](https://github.com/phenixdigital/phoenix_storybook/raw/main/screenshots/screenshot-02.jpg)

## How does it work?

PhxLiveStorybook is mounted in your application router and serves its UI at the mounting point of
PhoenixStorybook is mounted in your application router and serves its UI at the mounting point of
your choice.

It performs automatic discovery of your storybook content under a specified folder (`:content_path`)
Expand All @@ -41,19 +41,19 @@ Three kinds of stories are supported:

## Installation

To start using `PhxLiveStorybook` in your phoenix application you will need to follow these steps:
To start using `PhoenixStorybook` in your phoenix application you will need to follow these steps:

1. Add the `phx_live_storybook` dependency
1. Add the `phoenix_storybook` dependency
2. Run the generator

### 1. Add the `phx_live_storybook` dependency
### 1. Add the `phoenix_storybook` dependency

Add the following to your mix.exs and run mix deps.get:

```elixir
def deps do
[
{:phx_live_storybook, "~> 0.4.0"}
{:phoenix_storybook, "~> 0.4.0"}
]
end
```
Expand All @@ -78,14 +78,14 @@ Of all config settings, only the `:otp_app`, and `:content_path` keys are mandat
```elixir
# lib/my_app_web/storybook.ex
defmodule MyAppWeb.Storybook do
use PhxLiveStorybook,
use PhoenixStorybook,
# OTP name of your application.
otp_app: :my_app,

# Path to your storybook stories (required).
content_path: Path.expand("../storybook", __DIR__),

# Path to your JS asset, which will be loaded just before PhxLiveStorybook's own
# Path to your JS asset, which will be loaded just before PhoenixStorybook's own
# JS. It's mainly intended to define your LiveView Hooks in `window.storybook.Hooks`.
# Remote path (not local file-system path) which means this file should be served
# by your own application endpoint.
Expand Down Expand Up @@ -150,11 +150,11 @@ config :my_app, MyAppWeb.Storybook,

We would love your PRs!

1. Pull down phx_live_storybook to a directory next to your project (`../phx_live_storybook`).
1. Pull down phoenix_storybook to a directory next to your project (`../phoenix_storybook`).
2. Change your mix file to point to this directory:

```elixir
{:phx_live_storybook, path: "../phx_live_storybook"},
{:phoenix_storybook, path: "../phoenix_storybook"},
```

3. Run dev.storybook mix task from your project
Expand Down
4 changes: 2 additions & 2 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions assets/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "phx_live_storybook",
"name": "phoenix_storybook",
"version": "1.0.0",
"description": "PhxLiveStorybook assets",
"main": "./assets/js/phx_live_storybook.js",
"description": "PhoenixStorybook assets",
"main": "./assets/js/phoenix_storybook.js",
"scripts": {
"build:css": "tailwindcss --minify -i css/app.css -o ../priv/static/css/app.css",
"build:fonts_css": "tailwindcss --minify -i css/fonts.css -o ../priv/static/css/fonts.css",
Expand Down
4 changes: 2 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Config

config :phoenix, :json_library, Jason

config :phx_live_storybook, :env, config_env()
config :phx_live_storybook, :gzip_assets, false
config :phoenix_storybook, :env, config_env()
config :phoenix_storybook, :gzip_assets, false

import_config "#{config_env()}.exs"
2 changes: 1 addition & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import Config
config :phx_live_storybook, :gzip_assets, true
config :phoenix_storybook, :gzip_assets, true
2 changes: 1 addition & 1 deletion coveralls.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"output_dir": "coverage/",
"treat_no_relevant_lines_as_covered": true
},
"skip_files": ["test/fixtures", "lib/phx_live_storybook/web.ex"]
"skip_files": ["test/fixtures", "lib/phoenix_storybook/web.ex"]
}
18 changes: 9 additions & 9 deletions guides/components.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Component stories

Basic component documentation is in `PhxLiveStorybook.Story`.
Basic component documentation is in `PhoenixStorybook.Story`.

## Documentation

Expand All @@ -9,7 +9,7 @@ Component documentation is fetched from your component doc tags:
- For a live_component, fetches `@moduledoc` content.
- For a function component, fetches `@doc` content from the matching function.

If you are deploying `phx_live_storybook` in production with an Elixir release, make sure your
If you are deploying `phoenix_storybook` in production with an Elixir release, make sure your
doc chunks are not [stripped out from the release.](https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-customization)

```elixir
Expand All @@ -25,7 +25,7 @@ releases: [
## Variation groups

You may want to present different variations of a component in a single variation block.
It is possible using `PhxLiveStorybook.VariationGroup`.
It is possible using `PhoenixStorybook.VariationGroup`.

## Container

Expand All @@ -35,7 +35,7 @@ You can pass additional HTML attributes or extend the class attribute.
```elixir
# storybook/my_component.story.exs
defmodule Storybook.MyComponent do
use PhxLiveStorybook.Story, :component
use PhoenixStorybook.Story, :component
def container, do: {:div, class: "block"}
end
```
Expand All @@ -45,7 +45,7 @@ If you need further _sandboxing_ you can opt in for `iframe` rendering.
```elixir
# storybook/my_component.story.exs
defmodule Storybook.MyComponent do
use PhxLiveStorybook.Story, :component
use PhoenixStorybook.Story, :component
def container, do: :iframe
end
```
Expand All @@ -62,7 +62,7 @@ Here is an example defining both:

```elixir
defmodule NestedComponent do
use PhxLiveStorybook.Story, :component
use PhoenixStorybook.Story, :component
def function, do: &NestedComponent.nested_component/1

def aliases, do: [MyStorybook.Helpers.JSHelpers]
Expand Down Expand Up @@ -159,7 +159,7 @@ classes through [JS commands](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveV

```elixir
defmodule Storybook.Components.Modal do
use PhxLiveStorybook.Story, :component
use PhoenixStorybook.Story, :component

def function, do: &Components.Modal.modal/1

Expand Down Expand Up @@ -188,12 +188,12 @@ end
Some components don't rely on JS commands but need external assigns, like a modal that takes a
`show={true}` or `show={false}` assign to manage its visibility state.

`PhxLiveStorybook` handles special `assign` and `toggle` events that you
`PhoenixStorybook` handles special `assign` and `toggle` events that you
can leverage on to update some properties that will be passed to your components as _extra assigns_.

```elixir
defmodule Storybook.Components.Slideover do
use PhxLiveStorybook.Story, :component
use PhoenixStorybook.Story, :component
def function, do: &Components.Slideover.slideover/1

def template do
Expand Down
8 changes: 4 additions & 4 deletions guides/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
You can provide custom sidebar & header icons for your stories.
Page stories can also provide iconized navigation tabs.

PhxLiveStorybook gives you the ability to render icons with 2 different providers:
PhoenixStorybook gives you the ability to render icons with 2 different providers:

- [FontAwesome](https://fontawesome.com) which offers a decent set of free icons and a lot of
additional styles with paid plans
Expand All @@ -28,15 +28,15 @@ The two last tuple elements are optional.

## FontAwesome icons

PhxLiveStorybook is built with a very small subset of FontAwesome free icons. If you want to use
PhoenixStorybook is built with a very small subset of FontAwesome free icons. If you want to use
other FontAwesome icons you need to provide a valid **FontAwesome kit id**.

It can be either free or paid, so you also need to configure your FontAwesome plan.

```elixir
# lib/my_app_web/storybook.ex
defmodule MyAppWeb.Storybook do
use PhxLiveStorybook,
use PhoenixStorybook,
otp_app: :my_app,
font_awesome_plan: :pro, # default value is :free
font_awesome_kit_id: "foo8b41bar4625",
Expand All @@ -45,7 +45,7 @@ end

## HeroIcons

PhxLiveStorybook delegates icon rendering to [heroicons_elixir](https://github.com/mveytsman/heroicons_elixir).
PhoenixStorybook delegates icon rendering to [heroicons_elixir](https://github.com/mveytsman/heroicons_elixir).
Make sure to add their dependency in your `mix.exs` file.

```elixir
Expand Down
Loading

0 comments on commit 1b1b3c7

Please sign in to comment.