-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # CHANGELOG.md # Cargo.toml # src/use_user_media.rs # src/use_websocket.rs
- Loading branch information
Showing
22 changed files
with
846 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# use_textarea_autosize | ||
|
||
<!-- cmdrun python3 ../extract_doc_comment.py use_textarea_autosize use_textarea_autosize --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "use_textarea_autosize" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
leptos = { version = "0.6", features = ["nightly", "csr"] } | ||
console_error_panic_hook = "0.1" | ||
console_log = "1" | ||
log = "0.4" | ||
leptos-use = { path = "../..", features = ["use_textarea_autosize", "docs"] } | ||
web-sys = "0.3" | ||
|
||
[dev-dependencies] | ||
wasm-bindgen = "0.2" | ||
wasm-bindgen-test = "0.3.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
A simple example for `use_textarea_autosize`. | ||
|
||
If you don't have it installed already, install [Trunk](https://trunkrs.dev/) and [Tailwind](https://tailwindcss.com/docs/installation) | ||
as well as the nightly toolchain for Rust and the wasm32-unknown-unknown target: | ||
|
||
```bash | ||
cargo install trunk | ||
npm install -D tailwindcss @tailwindcss/forms | ||
rustup toolchain install nightly | ||
rustup target add wasm32-unknown-unknown | ||
``` | ||
|
||
Then, open two terminals. In the first one, run: | ||
|
||
``` | ||
npx tailwindcss -i ./input.css -o ./style/output.css --watch | ||
``` | ||
|
||
In the second one, run: | ||
|
||
```bash | ||
trunk serve --open | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
public_url = "/demo/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link data-trunk rel="css" href="style/output.css"> | ||
</head> | ||
<body></body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[toolchain] | ||
channel = "nightly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use leptos::*; | ||
use leptos_use::docs::demo_or_body; | ||
use leptos_use::{use_textarea_autosize, UseTextareaAutosizeReturn}; | ||
|
||
#[component] | ||
fn Demo() -> impl IntoView { | ||
let textarea = create_node_ref::<html::Textarea>(); | ||
|
||
let UseTextareaAutosizeReturn { | ||
content, | ||
set_content, | ||
.. | ||
} = use_textarea_autosize(textarea); | ||
|
||
view! { | ||
<div class="mb-4">Type, the textarea will grow:</div> | ||
<textarea | ||
value=content | ||
on:input=move |evt| set_content.set(event_target_value(&evt)) | ||
node_ref=textarea | ||
class="resize-none box-border" | ||
placeholder="What's on your mind?" | ||
/> | ||
} | ||
} | ||
|
||
fn main() { | ||
_ = console_log::init_with_level(log::Level::Debug); | ||
console_error_panic_hook::set_once(); | ||
|
||
mount_to(demo_or_body(), || { | ||
view! { <Demo /> } | ||
}) | ||
} |
Oops, something went wrong.