Skip to content

Commit

Permalink
docs: improve descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
brofrain committed Oct 26, 2023
1 parent 430bb9c commit 12e3d9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.1"
edition = "2021"
repository = "https://github.com/brofrain/leptos-animated-for"
license = "MIT"
description = "`<AnimatedFor />` component using FLIP transitions for Leptos"
description = "`<AnimatedFor />` component utilizing FLIP position transitions for Leptos"
keywords = ["leptos", "animations", "dom", "web", "wasm"]

[dependencies]
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# `<AnimatedFor />` component for [Leptos](https://leptos.dev/)

> Animation tool for insertions, removals, and order changes of grouped elements and components using [FLIP](https://aerotwist.com/blog/flip-your-animations/) technique.
[FLIP](https://aerotwist.com/blog/flip-your-animations/) animations for element and component groups inspired by Vue's [`<TransitionGroup>`](https://vuejs.org/guide/built-ins/transition-group.html).

<p align="center">
<img width="400" src="docs/preview.gif">
</p>

This crate exports a component similar to Leptos' built-in `<For />` with additional properties for applying specific CSS classes to nodes that:
This crate exports a component similar to Leptos' built-in [`<For />`](https://docs.rs/leptos/latest/leptos/fn.For.html) with additional properties for applying specific CSS classes to nodes that:

- are initially rendered
- are rendered for the first time

- represent already removed items

Expand All @@ -35,7 +35,7 @@ view! {

- `enter_class` - appended to entering elements. The class is removed on a [transitionend](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionend_event) or [animationend](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event) event, or if move transition is triggered before this one ends.

- `move_class` - active class for elements moving to their new positions. The class is removed on a `transitionend` or `animationend` event (same as enter_class). Reordering items again before they reach their destinations will stagger the animation and override the target positions.
- `move_class` - active class for elements moving to their new positions. The class is removed on a `transitionend` or `animationend` event (same as `enter_class`). Reordering items again before they reach their destinations will stagger the animation and overwrite the target positions.

- `leave_class` - removed items have their elements present in the DOM with this class applied. The nodes are removed on a `transitionend` or `animationend` event.

Expand Down
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,19 @@ where
})
}

/// List-rendering component utilizing FLIP position transitions.
/// Read the full guide [here](https://github.com/brofrain/leptos-animated-for).
#[allow(clippy::module_name_repetitions)]
#[component(transparent)]
pub fn AnimatedFor<Items, ItemIter, Item, Child, ChildFn, Key, KeyFn>(
each: Items,
key: KeyFn,
children: ChildFn,
#[prop(optional, into)] appear: Option<bool>,
#[prop(optional, into)] move_class: MaybeProp<String>,
#[prop(optional, into)] enter_class: MaybeProp<String>,
#[prop(optional, into)] enter_from_class: MaybeProp<String>,
#[prop(optional, into)] enter_class: MaybeProp<String>,
#[prop(optional, into)] move_class: MaybeProp<String>,
#[prop(optional, into)] leave_class: MaybeProp<String>,
#[prop(optional, into)] appear: Option<bool>,
) -> impl IntoView
where
Items: Fn() -> ItemIter + 'static,
Expand Down

0 comments on commit 12e3d9a

Please sign in to comment.