docs(examples): move list example to examples folder (#1653)
see #1512 also renames it to todo-list
This commit is contained in:
9
Cargo.lock
generated
9
Cargo.lock
generated
@@ -3485,6 +3485,15 @@ dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "todo-list"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"color-eyre",
|
||||
"crossterm",
|
||||
"ratatui",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.43.0"
|
||||
|
||||
@@ -102,6 +102,10 @@ Shows how to use the inlined viewport to render in a specific area of the screen
|
||||
|
||||
Shows how to render a form with input fields. [Source](./apps/input-form/).
|
||||
|
||||
## Todo List demo
|
||||
|
||||
Shows how to create a simple todo list application. [Source](./apps/todo-list/).
|
||||
|
||||
## Mouse Drawing demo
|
||||
|
||||
Shows how to handle mouse events. [Source](./apps/mouse-drawing/).
|
||||
|
||||
14
examples/apps/todo-list/Cargo.toml
Normal file
14
examples/apps/todo-list/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "todo-list"
|
||||
publish = false
|
||||
license.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
color-eyre.workspace = true
|
||||
crossterm.workspace = true
|
||||
ratatui.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
9
examples/apps/todo-list/README.md
Normal file
9
examples/apps/todo-list/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Todo list demo
|
||||
|
||||
This example demonstrates a simple todo list application.
|
||||
|
||||
To run this demo:
|
||||
|
||||
```shell
|
||||
cargo run -p todo-list
|
||||
```
|
||||
@@ -1,18 +1,10 @@
|
||||
//! # [Ratatui] List example
|
||||
//!
|
||||
//! The latest version of this example is available in the [examples] folder in the repository.
|
||||
//!
|
||||
//! Please note that the examples are designed to be run against the `main` branch of the Github
|
||||
//! repository. This means that you may not be able to compile with the latest release version on
|
||||
//! crates.io, or the one that you have installed locally.
|
||||
//!
|
||||
//! See the [examples readme] for more information on finding examples that match the version of the
|
||||
//! library you are using.
|
||||
//!
|
||||
//! [Ratatui]: https://github.com/ratatui/ratatui
|
||||
//! [examples]: https://github.com/ratatui/ratatui/blob/main/examples
|
||||
//! [examples readme]: https://github.com/ratatui/ratatui/blob/main/examples/README.md
|
||||
|
||||
/// A Ratatui example that demonstrates how to create a todo list with selectable items.
|
||||
///
|
||||
/// This example runs with the Ratatui library code in the branch that you are currently
|
||||
/// reading. See the [`latest`] branch for the code which works with the most recent Ratatui
|
||||
/// release.
|
||||
///
|
||||
/// [`latest`]: https://github.com/ratatui/ratatui/tree/latest
|
||||
use color_eyre::Result;
|
||||
use ratatui::{
|
||||
buffer::Buffer,
|
||||
@@ -193,7 +185,7 @@ impl Widget for &mut App {
|
||||
/// Rendering logic for the app
|
||||
impl App {
|
||||
fn render_header(area: Rect, buf: &mut Buffer) {
|
||||
Paragraph::new("Ratatui List Example")
|
||||
Paragraph::new("Ratatui Todo List Example")
|
||||
.bold()
|
||||
.centered()
|
||||
.render(area, buf);
|
||||
@@ -147,11 +147,6 @@ bench = false
|
||||
name = "main"
|
||||
harness = false
|
||||
|
||||
[[example]]
|
||||
name = "list-widget"
|
||||
required-features = ["crossterm"]
|
||||
doc-scrape-examples = true
|
||||
|
||||
[[example]]
|
||||
name = "modifiers"
|
||||
required-features = ["crossterm"]
|
||||
|
||||
Reference in New Issue
Block a user