mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-23 06:19:22 -05:00
docs: Modal Binder CSSTransition (#122)
This commit is contained in:
parent
f035555626
commit
5c86e996f9
3 changed files with 36 additions and 5 deletions
|
@ -13,11 +13,14 @@ view! {
|
||||||
|
|
||||||
### Modal Props
|
### Modal Props
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
| -------- | --------------------- | -------------------- | ---------------------- |
|
| -------------- | --------------------- | -------------------- | ------------------------------------------- |
|
||||||
| show | `Model<bool>` | | Whether to show modal. |
|
| show | `Model<bool>` | | Whether to show modal. |
|
||||||
| title | `MaybeSignal<String>` | `Default::default()` | Modal title. |
|
| title | `MaybeSignal<String>` | `Default::default()` | Modal title. |
|
||||||
| children | `Children` | | Modal's content. |
|
| width | `MaybeSignal<String>` | `600px` | Modal width. |
|
||||||
|
| z_index | `MaybeSignal<i16>` | `2000` | z-index of the modal. |
|
||||||
|
| mask_closeable | `MaybeSignal<bool>` | `true` | Whether to emit hide event when click mask. |
|
||||||
|
| children | `Children` | | Modal's content. |
|
||||||
|
|
||||||
### Modal Slots
|
### Modal Slots
|
||||||
|
|
||||||
|
|
|
@ -26,15 +26,40 @@ pub struct Follower {
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum FollowerWidth {
|
pub enum FollowerWidth {
|
||||||
|
/// The popup width is the same as the target DOM width.
|
||||||
Target,
|
Target,
|
||||||
|
/// Customize the popup width.
|
||||||
Px(u32),
|
Px(u32),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for FollowerWidth {}
|
impl Copy for FollowerWidth {}
|
||||||
|
|
||||||
|
|
||||||
|
/// # Tracking popup
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// use crate::components::{Binder, Follower, FollowerPlacement};
|
||||||
|
/// use leptos::*;
|
||||||
|
///
|
||||||
|
/// let div_ref= NodeRef::new();
|
||||||
|
/// let show = RwSignal::new(false);
|
||||||
|
///
|
||||||
|
/// view! {
|
||||||
|
/// <Binder target_ref=div_ref>
|
||||||
|
/// <div ref=div_ref>
|
||||||
|
/// "content"
|
||||||
|
/// </div>
|
||||||
|
/// <Follower slot show placement=FollowerPlacement::BottomStart>
|
||||||
|
/// "content2"
|
||||||
|
/// </Follower>
|
||||||
|
/// </Binder>
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Binder<El: ElementDescriptor + Clone + 'static>(
|
pub fn Binder<El: ElementDescriptor + Clone + 'static>(
|
||||||
|
/// Used to track DOM locations
|
||||||
#[prop(into)] target_ref: NodeRef<El>,
|
#[prop(into)] target_ref: NodeRef<El>,
|
||||||
|
/// Content for pop-up display
|
||||||
follower: Follower,
|
follower: Follower,
|
||||||
children: Children,
|
children: Children,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
use leptos::{html::ElementDescriptor, *};
|
use leptos::{html::ElementDescriptor, *};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
|
/// # CSS Transition
|
||||||
|
///
|
||||||
|
/// Reference to https://vuejs.org/guide/built-ins/transition.html
|
||||||
#[component]
|
#[component]
|
||||||
pub fn CSSTransition<T, CF, IV>(
|
pub fn CSSTransition<T, CF, IV>(
|
||||||
node_ref: NodeRef<T>,
|
node_ref: NodeRef<T>,
|
||||||
|
|
Loading…
Add table
Reference in a new issue