Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions thaw/src/grid/docs/mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ view! {
| cols | `Signal<u16>` | `1` | Number of grids displayed. |
| x_gap | `Signal<u16>` | `0` | Horizontal gap. |
| y_gap | `Signal<u16>` | `0` | Vertical gap. |
| min | `Signal<String>` | `0px` | Min width of columns. |
| max | `Signal<String>` | `1fr` | Max width of columns. |
| children | `Children` | | |

### GridItem Props
Expand Down
14 changes: 12 additions & 2 deletions thaw/src/grid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ pub fn Grid(
/// Vertical gap.
#[prop(optional, into)]
y_gap: Signal<u16>,
/// The min width of columns.
/// Defaults to "0px".
#[prop(into, default = "0px".into())]
min: Signal<String>,
/// The max width of columns.
/// Defaults to "1fr".
#[prop(into, default = "1fr".into())]
max: Signal<String>,
children: Children,
) -> impl IntoView {
let style = Memo::new(move |_| {
let mut style = String::from("display: grid;");
style.push_str(&format!(
"grid-template-columns: repeat({}, minmax(0px, 1fr));",
cols.get()
"grid-template-columns: repeat({}, minmax({}, {}));",
cols.get(),
min.get(),
max.get()
));
style.push_str(&format!("grid-gap: {}px {}px;", y_gap.get(), x_gap.get()));
style
Expand Down
2 changes: 1 addition & 1 deletion thaw/src/input/docs/mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ view! {
| autofocus | `Signal<bool>` | `false` | Whether the input receives focus automatically. |
| disabled | `Signal<bool>` | `false` | Whether the input is disabled. |
| readonly | `Signal<bool>` | `false` | Whether the input is readonly. |
| input_size | `Signal<Option<i32>>` | `None` | The input size width. |
| input_size | `Signal<Option<u32>>` | `None` | The input size width. |
| on_focus | `Option<BoxOneCallback<ev::FocusEvent>>` | `None` | Callback triggered when the input is focussed on. |
| on_blur | `Option<BoxOneCallback<ev::FocusEvent>>` | `None` | Callback triggered when the input is blurred. |
| parser | `OptionalProp<BoxOneCallback<String, Option<String>>>` | `None` | Modifies the user input before assigning it to the value. |
Expand Down
2 changes: 1 addition & 1 deletion thaw/src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn Input(
readonly: Signal<bool>,
/// Input size width.
#[prop(optional, into)]
input_size: Signal<Option<i32>>,
input_size: Signal<Option<u32>>,
#[prop(optional)] input_prefix: Option<InputPrefix>,
#[prop(optional)] input_suffix: Option<InputSuffix>,
#[prop(optional, into)] input_style: MaybeProp<String>,
Expand Down
1 change: 1 addition & 0 deletions thaw/src/spin_button/docs/mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ view! {
| max | `Signal<T>` | `T::max_value()` | The maximum number that the input value can take. |
| disabled | `Signal<bool>` | `false` | Whether the input is disabled. |
| size | `Signal<SpinButtonSize>` | `SpinButtonSize::Medium` | Size of the input. |
| input_size | `Signal<Option<u32>>` | `None` | The input size width. |
| parser | `OptionalProp<BoxOneCallback<String, Option<T>>>` | `None` | Modifies the user input before assigning it to the value. |
| format | `OptionalProp<BoxOneCallback<T, String>>` | `None` | Formats the value to be shown to the user. |

Expand Down
4 changes: 4 additions & 0 deletions thaw/src/spin_button/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ pub fn SpinButton<T>(
/// Size of the input.
#[prop(optional, into)]
size: Signal<SpinButtonSize>,
/// Input size width.
#[prop(optional, into)]
input_size: Signal<Option<u32>>,
/// Modifies the user input before assigning it to the value.
#[prop(optional, into)]
parser: OptionalProp<BoxOneCallback<String, Option<T>>>,
Expand Down Expand Up @@ -116,6 +119,7 @@ where
disabled=move || disabled.get()
placeholder=move || placeholder.get()
value=initialization_value
size=input_size
prop:value=move || {
let value = value.get();
if let Some(format) = format.as_ref() {
Expand Down