Skip to content

Commit

Permalink
added bindings to the key prop
Browse files Browse the repository at this point in the history
  • Loading branch information
cometkim committed Jan 24, 2023
1 parent 2818d0b commit 033a4bf
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-pumpkins-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"rescript-ink": patch
---

Added bindings to the key prop
2 changes: 2 additions & 0 deletions packages/ink/src/Ink_Components_Box.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
open Ink_Style

let makeProps = (
~key: option<string>=?,
~ref: option<Ink_Ref.t>=?,
~children: option<React.element>=?,
~display: option<display>=?,
Expand Down Expand Up @@ -34,6 +35,7 @@ let makeProps = (
(),
) =>
{
"key": key,
"ref": ref,
"children": children,
"display": switch display {
Expand Down
3 changes: 2 additions & 1 deletion packages/ink/src/Ink_Components_Newline.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
let makeProps = (~ref: option<Ink_Ref.t>=?, ~count: option<int>=?, ()) =>
let makeProps = (~key: option<string>=?, ~ref: option<Ink_Ref.t>=?, ~count: option<int>=?, ()) =>
{
"key": key,
"ref": ref,
"count": count,
}
Expand Down
3 changes: 2 additions & 1 deletion packages/ink/src/Ink_Components_Spacer.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
let makeProps = (~ref: option<Ink_Ref.t>=?, ()) =>
let makeProps = (~key: option<string>=?, ~ref: option<Ink_Ref.t>=?, ()) =>
{
"key": key,
"ref": ref,
}

Expand Down
2 changes: 2 additions & 0 deletions packages/ink/src/Ink_Components_Static.res
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,15 @@ let convert = (styleProp: option<styleProp>) =>
}

let makeProps = (
~key: option<string>=?,
~ref: option<Ink_Ref.t>=?,
~items: array<'a>,
~renderItems: ('a, int) => React.element,
~style: option<styleProp>=?,
(),
) =>
{
"key": key,
"ref": ref,
"items": items,
"children": renderItems,
Expand Down
2 changes: 2 additions & 0 deletions packages/ink/src/Ink_Components_Text.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include Ink_Style

let makeProps = (
~key: option<string>=?,
~ref: option<Ink_Ref.t>=?,
~color: option<color>=?,
~backgroundColor: option<color>=?,
Expand All @@ -15,6 +16,7 @@ let makeProps = (
(),
) =>
{
"key": key,
"ref": ref,
"color": switch color {
| Some(color) => Some(color->Color.toString)
Expand Down
2 changes: 2 additions & 0 deletions packages/ink/src/Ink_Components_Transform.res
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
let makeProps = (
~key: option<string>,
~ref: option<Ink_Ref.t>,
~children: React.element,
~transform: string => string,
(),
) =>
{
"key": key,
"ref": ref,
"children": children,
"transform": transform,
Expand Down
9 changes: 5 additions & 4 deletions packages/ink/src/Ink_Style.res
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ module Size = {
| #percent(percent)
]

let unwrap = t => switch t {
| #length(length) => length->unwrap
| #percent(percent) => percent->unwrap
}
let unwrap = t =>
switch t {
| #length(length) => length->unwrap
| #percent(percent) => percent->unwrap
}
}

type size = Size.t
Expand Down

0 comments on commit 033a4bf

Please sign in to comment.