mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-22 16:49:22 -05:00
Docs: Update See also references in media query functions
- Added `use_prefers_reduced_motion` in the documentation for `use_media_query`, `use_preferred_contrast`, and `use_preferred_dark` functions to include links to related functions.
This commit is contained in:
parent
6d57bdf7f5
commit
f5a37f6c7f
3 changed files with 4 additions and 1 deletions
|
@ -38,6 +38,7 @@ use std::rc::Rc;
|
||||||
///
|
///
|
||||||
/// * [`fn@crate::use_preferred_dark`]
|
/// * [`fn@crate::use_preferred_dark`]
|
||||||
/// * [`fn@crate::use_preferred_contrast`]
|
/// * [`fn@crate::use_preferred_contrast`]
|
||||||
|
/// * [`fn@crate::use_prefers_reduced_motion`]
|
||||||
pub fn use_media_query(query: impl Into<MaybeSignal<String>>) -> Signal<bool> {
|
pub fn use_media_query(query: impl Into<MaybeSignal<String>>) -> Signal<bool> {
|
||||||
let query = query.into();
|
let query = query.into();
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ use std::fmt::Display;
|
||||||
///
|
///
|
||||||
/// * [`fn@crate::use_media_query`]
|
/// * [`fn@crate::use_media_query`]
|
||||||
/// * [`fn@crate::use_preferred_dark`]
|
/// * [`fn@crate::use_preferred_dark`]
|
||||||
|
/// * [`fn@crate::use_prefers_reduced_motion`]
|
||||||
pub fn use_preferred_contrast() -> Signal<PreferredContrast> {
|
pub fn use_preferred_contrast() -> Signal<PreferredContrast> {
|
||||||
let is_more = use_media_query("(prefers-contrast: more)");
|
let is_more = use_media_query("(prefers-contrast: more)");
|
||||||
let is_less = use_media_query("(prefers-contrast: less)");
|
let is_less = use_media_query("(prefers-contrast: less)");
|
||||||
|
@ -53,8 +54,8 @@ pub enum PreferredContrast {
|
||||||
Custom,
|
Custom,
|
||||||
#[default]
|
#[default]
|
||||||
NoPreference,
|
NoPreference,
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
impl Display for PreferredContrast {
|
impl Display for PreferredContrast {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
|
|
|
@ -41,6 +41,7 @@ use std::rc::Rc;
|
||||||
///
|
///
|
||||||
/// * [`fn@crate::use_media_query`]
|
/// * [`fn@crate::use_media_query`]
|
||||||
/// * [`fn@crate::use_preferred_contrast`]
|
/// * [`fn@crate::use_preferred_contrast`]
|
||||||
|
/// * [`fn@crate::use_prefers_reduced_motion`]
|
||||||
pub fn use_preferred_dark() -> Signal<bool> {
|
pub fn use_preferred_dark() -> Signal<bool> {
|
||||||
use_preferred_dark_with_options(Default::default())
|
use_preferred_dark_with_options(Default::default())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue