Skip to content

Commit

Permalink
docs: Update README with better tests 📚
Browse files Browse the repository at this point in the history
  • Loading branch information
kdheepak committed Jan 9, 2024
1 parent 31a2c45 commit 57b681b
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,29 @@ Use the `constraints!` macro to define layout constraints:

```rust
use ratatui_macros::constraints;
constraints![==50, ==30%, >=3, <=1, ==1/2];
// is equivalent to
[
ratatui::prelude::Constraint::Length(50),
ratatui::prelude::Constraint::Percentage(30),
ratatui::prelude::Constraint::Min(3),
ratatui::prelude::Constraint::Max(1),
ratatui::prelude::Constraint::Ratio(1, 2),
];
assert_eq!(
constraints![==50, ==30%, >=3, <=1, ==1/2],
[
ratatui::prelude::Constraint::Length(50),
ratatui::prelude::Constraint::Percentage(30),
ratatui::prelude::Constraint::Min(3),
ratatui::prelude::Constraint::Max(1),
ratatui::prelude::Constraint::Ratio(1, 2),
]
)
```

```rust
use ratatui_macros::constraints;
constraints![==1/4; 4];
// is equivalent to
[
ratatui::prelude::Constraint::Ratio(1, 4),
ratatui::prelude::Constraint::Ratio(1, 4),
ratatui::prelude::Constraint::Ratio(1, 4),
ratatui::prelude::Constraint::Ratio(1, 4),
];
assert_eq!(
constraints![==1/4; 4],
[
ratatui::prelude::Constraint::Ratio(1, 4),
ratatui::prelude::Constraint::Ratio(1, 4),
ratatui::prelude::Constraint::Ratio(1, 4),
ratatui::prelude::Constraint::Ratio(1, 4),
]
)
```

Create vertical and horizontal layouts using the `vertical!` and `horizontal!` macros:
Expand Down

0 comments on commit 57b681b

Please sign in to comment.