docs(examples): move list example to examples folder (#1653)

see #1512

also renames it to todo-list
This commit is contained in:
Orhun Parmaksız
2025-02-06 23:36:26 +03:00
committed by GitHub
parent e48bcf5f21
commit d87354f400
6 changed files with 44 additions and 21 deletions

9
Cargo.lock generated
View File

@@ -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"

View File

@@ -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/).

View 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

View 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
```

View File

@@ -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);

View File

@@ -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"]