Skip to content

Commit 360653d

Browse files
author
Nils Henning
committed
[TASK] add transition guide
1 parent 50639e5 commit 360653d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

docs/guides/400-transitions/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Transitions
22

3-
![Coming Soon](../../images/coming_soon.png)
4-
53
Matestack `transition` component enables switching between pages without a website reload. It works similar to links, but instead of reloading the complete website, including the layout like Rails usually does, it only asynchronously reloads the page without the app and replaces it dynamically.
64

75
The `transition` component is therefore one of the key components for you to use. You should use them instead of a link if the target path of that link belongs to the same app. Given a shopping application with a shop app, links to our root, products index or details page should be transitions, because they belong to the shop app. The use of transitions enables the app to switch between pages without website reloads, instead asynchronously requesting the new page in the background and switching it after a successful response from the server.
86

7+
1. [Usage](#usage)
8+
2. [Styling active transitions and it's parents](#styling-active-transitions-and-its-parents)
9+
10+
## Usage
11+
912
Using the `transition` component is pretty straight forward. Let's take the above mentioned shop app as an example and implement it and add a navigation with transitions to the home or products page. `transition`s are ofcourse usable in apps, pages and components.
1013

1114
```ruby
@@ -22,8 +25,6 @@ class Shop::App < Matestack::Ui::App
2225
end
2326
```
2427

25-
Styling a transition which is _active_ is simple, because it automatically gets the `active` class on the clientside when the current path equals it's target path. When a sub page of a parent `transition` component is currently active, the parent `transition` component gets a `active-child` class.
26-
2728
Let's add the products page which simply lists all products and adds a transition to their show page for each one.
2829

2930
```ruby
@@ -41,4 +42,10 @@ class Shop::Pages::Products::Index < Matestack::Ui::Page
4142
end
4243
```
4344

45+
## Styling active transitions and it's parents
46+
47+
Styling a transition which is _active_ is simple, because it automatically gets the `active` class on the clientside when the current path equals it's target path. When a sub page of a parent `transition` component is currently active, the parent `transition` component gets a `active-child` class.
48+
49+
50+
4451
If you want to know all details about the `transition` component, like how you can delay it or what events it emits, checkout it's [api documentation](docs/api/100-components/transition.md)

0 commit comments

Comments
 (0)