@colisweb/rescript-toolkit 3.4.1 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -23,7 +23,7 @@ let make = () => {
23
23
  Js.log(tabValue)
24
24
  }}
25
25
  buttons={[
26
- {label: "Option 1"->React.string, value: "test"},
26
+ {label: "Option 1"->React.string, value: "test", count: 10},
27
27
  {label: "Option 2"->React.string, onClick: _ => alert("clicked on option 2")},
28
28
  {label: "Option 3"->React.string},
29
29
  ]}
@@ -7,6 +7,7 @@ type button<'value> = {
7
7
  onClick?: ReactEvent.Mouse.t => unit,
8
8
  label: React.element,
9
9
  value?: 'value,
10
+ count?: int,
10
11
  }
11
12
 
12
13
  type buttons<'value> = array<button<'value>>
@@ -53,6 +54,19 @@ let make = (
53
54
  }}
54
55
  className={cx([activeIndex === i ? "selected" : ""])}>
55
56
  {button.label}
57
+ {button.count->Option.mapWithDefault(React.null, count => {
58
+ <span
59
+ className={cx([
60
+ "ml-2 bg-gray-300/40 rounded px-1.5 ",
61
+ switch size {
62
+ | #md => "text-xs"
63
+ | #xl => "text-sm"
64
+ },
65
+ activeIndex === i ? "text-white fn" : "text-black",
66
+ ])}>
67
+ {count->React.int}
68
+ </span>
69
+ })}
56
70
  </button>
57
71
  })
58
72
  ->React.array}
@@ -7,6 +7,7 @@ type button<'value> = {
7
7
  onClick?: ReactEvent.Mouse.t => unit,
8
8
  label: React.element,
9
9
  value?: 'value,
10
+ count?: int,
10
11
  }
11
12
 
12
13
  type buttons<'value> = array<button<'value>>