|
| 1 | +# [Kantan][kantan] (Typst package) |
| 2 | + |
| 3 | +[Kantan][kantan] (<ruby>簡単<rt>かんたん</rt></ruby>) is a package to _easily_ |
| 4 | +create a kanban board (<ruby>看板<rt>かんばん</rt></ruby>) of any scale. |
| 5 | + |
| 6 | +A bonus, is that the source code is so small, you can quickly modify any aspect |
| 7 | +of it, to make the board look the way you want. Because of composability, you |
| 8 | +can mix package functions with locally edited ones. |
| 9 | + |
| 10 | +## Usage |
| 11 | + |
| 12 | +### [Example 1] |
| 13 | + |
| 14 | +```typ |
| 15 | +#import "@preview/kantan:0.1.0": * |
| 16 | +// #set page(width: 16cm, height: auto, margin: 2pt) |
| 17 | +
|
| 18 | +// Dark theme |
| 19 | +#set page(fill: black) |
| 20 | +#set text(fill: white) |
| 21 | +#let kanban-item = kanban-item.with(fill: black) |
| 22 | +
|
| 23 | +#kanban( |
| 24 | + font-size: 0.80em, |
| 25 | + font: "Liberation Sans", |
| 26 | + kanban-column("Backlog", color: red, |
| 27 | + kanban-item(stroke: rgb("#FF5733"))[41][high][Authorization and data validation], |
| 28 | + kanban-item(stroke: rgb("#33FF57"))[18][high][Cart API integration], |
| 29 | + kanban-item(stroke: rgb("#8D33FF"))[18][medium][City dropdown menu], |
| 30 | + kanban-item(stroke: rgb("#FF33A1"))[7][medium][Dynamic cart item count], |
| 31 | + kanban-item(stroke: rgb("#33C1FF"))[5][medium][Main page prototype], |
| 32 | + kanban-item(stroke: rgb("#8D33FF"))[1][low][Tests for cart API], |
| 33 | + ), |
| 34 | + kanban-column("Work in progress", color: yellow, |
| 35 | + kanban-item(stroke: rgb("#FF5733"))[7][medium][John][Checkout page], |
| 36 | + kanban-item(stroke: rgb("#FF0000"))[18][medium][John][Stock availability check], |
| 37 | + kanban-item(stroke: rgb("#33FF57"))[18][medium][Olivia][Add/remove book tests], |
| 38 | + kanban-item(stroke: rgb("#33C1FF"))[7][medium][Stephen]["About Us" page layout], |
| 39 | + ), |
| 40 | + kanban-column("Testing", color: aqua, |
| 41 | + kanban-item(stroke: rgb("#FF5733"))[18][high][John][Add-to-cart API], |
| 42 | + kanban-item(stroke: rgb("#33C1FF"))[5][medium][Emily]["Contact Us" page], |
| 43 | + kanban-item(stroke: rgb("#FFC300"))[5][medium][Alex]["News" page mockup], |
| 44 | + ), |
| 45 | + kanban-column("Done", color: green, |
| 46 | + kanban-item(stroke: rgb("#FFC300"))[50][high][Michael][Books database], |
| 47 | + kanban-item(stroke: rgb("#FF33A1"))[32][high][Stephen][Books catalog with filters], |
| 48 | + kanban-item(stroke: rgb("#33FF57"))[1][low][Arthur]["About Us" page mockup], |
| 49 | + ), |
| 50 | +) |
| 51 | +``` |
| 52 | + |
| 53 | +<picture> |
| 54 | + <source |
| 55 | + media="(prefers-color-scheme: light)" |
| 56 | + srcset="./tests/example-en/ref/1.png"> |
| 57 | + <img alt="Kanban board in English" src="./tests/example-en/ref/2.png"> |
| 58 | +</picture> |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +### [Example 2] |
| 63 | + |
| 64 | +```typ |
| 65 | +#import "@preview/kantan:0.1.0": * |
| 66 | +// #set page(width: 17cm, height: auto, margin: 2pt) |
| 67 | +
|
| 68 | +// Dark theme |
| 69 | +#set page(fill: black) |
| 70 | +#set text(fill: white) |
| 71 | +#let kanban-item = kanban-item.with(fill: black) |
| 72 | +
|
| 73 | +#kanban( |
| 74 | + font-size: 0.80em, |
| 75 | + font: "Liberation Sans", |
| 76 | + kanban-column("Backlog", color: red, |
| 77 | + kanban-item(stroke: rgb("#FF5733"))[41][высокий][Авторизация с проверкой данных], |
| 78 | + kanban-item(stroke: rgb("#33FF57"))[18][высокий][Интеграция API корзины], |
| 79 | + kanban-item(stroke: rgb("#8D33FF"))[18][средний][Выпадающее меню города], |
| 80 | + kanban-item(stroke: rgb("#FF33A1"))[7][средний][Динамическое число товаров в корзине], |
| 81 | + kanban-item(stroke: rgb("#33C1FF"))[5][средний][Прототип главной страницы], |
| 82 | + kanban-item(stroke: rgb("#33C1FF"))[5][средний][Страница "Контакты"], |
| 83 | + kanban-item(stroke: rgb("#FFC300"))[5][средний][Макет страницы "Новости"], |
| 84 | + kanban-item(stroke: rgb("#8D33FF"))[1][низкий][Олеся][Тесты для API корзины], |
| 85 | + ), |
| 86 | + kanban-column("Work in progress", color: yellow, |
| 87 | + kanban-item(stroke: rgb("#FF5733"))[7][средний][Иван][Оформление заказа], |
| 88 | + kanban-item(stroke: rgb("#FF0000"))[18][средний][Иван][Проверка наличия книг на складе], |
| 89 | + kanban-item(stroke: rgb("#33FF57"))[18][средний][Олеся][Тесты для добавления/удаления книг], |
| 90 | + kanban-item(stroke: rgb("#33C1FF"))[7][средний][Степан][Вёрстка страницы "О~нас"], |
| 91 | + ), |
| 92 | + kanban-column("Testing", color: aqua, |
| 93 | + kanban-item(stroke: rgb("#FF5733"))[18][высокий][Иван][API для добавления книг в корзину], |
| 94 | + ), |
| 95 | + kanban-column("Done", color: green, |
| 96 | + kanban-item(stroke: rgb("#FFC300"))[50][высокий][Михаил][База данных для книг], |
| 97 | + kanban-item(stroke: rgb("#FF33A1"))[32][высокий][Степан][Каталог книг с фильтрацией], |
| 98 | + kanban-item(stroke: rgb("#33FF57"))[1][низкий][Артём][Макет страницы "О~нас"], |
| 99 | + ), |
| 100 | +) |
| 101 | +``` |
| 102 | + |
| 103 | +<picture> |
| 104 | + <source |
| 105 | + media="(prefers-color-scheme: light)" |
| 106 | + srcset="./tests/example-ru/ref/1.png"> |
| 107 | + <img alt="Kanban board in Russian" src="./tests/example-ru/ref/2.png"> |
| 108 | +</picture> |
| 109 | + |
| 110 | +## API |
| 111 | + |
| 112 | +### `kanban-item` |
| 113 | + |
| 114 | +```typ |
| 115 | +/// Create a single kanban board item that can be placed in `kanban-column`. |
| 116 | +/// |
| 117 | +/// - hardness-level (any): How hard the task is, its cost (usually a number). |
| 118 | +/// - priority-level (any): For example, can be "low", "medium", "high". |
| 119 | +/// - inset (relative, dictionary): Inset for: hardness, priority, assignee. |
| 120 | +/// - stroke (color, gradient, tiling, length, stroke): Stroke for item box. |
| 121 | +/// - height (auto, relative): Item height. |
| 122 | +/// - args (arguments): 1 positional argument is item name, 2 positional |
| 123 | +/// arguments is assignee and item name. |
| 124 | +#let kanban-item( |
| 125 | + hardness-level, |
| 126 | + priority-level, |
| 127 | + inset: 0.27em, |
| 128 | + stroke: 0.05em, |
| 129 | + height: auto, |
| 130 | + ..args, |
| 131 | +) |
| 132 | +``` |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +### `kanban-column` |
| 137 | + |
| 138 | +```typ |
| 139 | +/// Create a single kanban board column that can be placed in `kanban`. |
| 140 | +/// |
| 141 | +/// - name (str, content): Column name. |
| 142 | +/// - color (color, gradient, tiling): Column color. |
| 143 | +/// - items (arguments): Column items created with `kanban-item`. |
| 144 | +#let kanban-column(name, color: auto, ..items) |
| 145 | +``` |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +### `kanban` |
| 150 | + |
| 151 | +```typ |
| 152 | +/// Create a single kanban board item that can be placed in `kanban-column`. |
| 153 | +/// |
| 154 | +/// - width (auto, relative): Kanban board width. Default is `100%`. |
| 155 | +/// - item-spacing (relative): Spacing between items in a column. |
| 156 | +/// - leading (length): Paragraph leading to use inside the board. |
| 157 | +/// - font-size (length): Font size to use inside the board. |
| 158 | +/// - font (str, array, dictionary): Font to use inside the board. |
| 159 | +/// - args (arguments): Columns created with `kanban-column`. |
| 160 | +#let kanban( |
| 161 | + width: 100%, |
| 162 | + item-spacing: 0.5em, |
| 163 | + leading: 0.5em, |
| 164 | + font-size: 1em, |
| 165 | + font: (), |
| 166 | + ..args, |
| 167 | +) |
| 168 | +``` |
| 169 | + |
| 170 | +## License |
| 171 | + |
| 172 | +This Typst package is licensed under AGPL-3.0-only license. You can view the |
| 173 | +license in the [`LICENSE`] file in the root of the project or at |
| 174 | +<https://www.gnu.org/licenses/agpl-3.0.txt>. |
| 175 | + |
| 176 | +[kantan]: https://codeberg.org/Andrew15-5/kantan |
| 177 | +[Example 1]: ./tests/example-en/test.typ |
| 178 | +[Example 2]: ./tests/example-ru/test.typ |
| 179 | +[`LICENSE`]: ./LICENSE |
0 commit comments