Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 51a1924

Browse files
committed
feat(MakeProps): add sub-modules in MakeProps for handle object-fit, noOfLines, viewBox, and multi-type(string-or-number).
sub-modules of MakeProps: StringOrNumber, ObjectFit, NoOfLines, and ViewBox
1 parent 1703258 commit 51a1924

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

‎src/Interfaces/Chakra__MakeProps.res‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,16 @@ module Top = {
818818
let fromOption = o => o->optionMap(identity)
819819
}
820820

821+
module Sizes = {
822+
open Chakra__AtomicTypes
823+
let rec identity = x =>
824+
switch x {
825+
| #...Sizes.t as cs => cs->Sizes.toString->Identity.fromString
826+
| #array(arr) => arr->arrayMap(identity)->Identity.fromArray
827+
}
828+
let fromOption = o => o->optionMap(identity)
829+
}
830+
821831
module Right = Top
822832
module Bottom = Top
823833
module Left = Top
@@ -970,6 +980,55 @@ module Stat = {
970980
let fromOption = o => o->optionMap(identity)
971981
}
972982
}
983+
/**
984+
this is module for handle 2 type between [string] or [number]
985+
*/
986+
module StringOrNumber = {
987+
type t = [#str(string) | #num(float)]
988+
let identity = x =>
989+
switch x {
990+
| #str(str) => str->Identity.fromString
991+
| #num(num) => num->Identity.fromFloat
992+
}
993+
let fromOption = o => o->optionMap(identity)
994+
}
995+
/**
996+
Object fit module
997+
*/
998+
module ObjectFit = {
999+
open Chakra__AtomicTypes
1000+
let rec identity = x => {
1001+
switch x {
1002+
| #...ObjectFit.t as o => o->ObjectFit.toString->Identity.fromString
1003+
| #array(arr) => arr->arrayMap(identity)->Identity.fromArray
1004+
}
1005+
}
1006+
let fromOption = o => o->optionMap(identity)
1007+
}
1008+
1009+
module NoOfLines = {
1010+
@ocaml.text("It could be simply when [@unwrap] can use in [JavaScript] Object.")
1011+
let identity = x =>
1012+
switch x {
1013+
| #num(i) => i->Identity.fromInt
1014+
| #array(arr) => arr->Identity.fromArray
1015+
}
1016+
let fromOption = o => o->optionMap(identity)
1017+
}
1018+
1019+
module ViewBox = {
1020+
type t = [#viewBox(float, float, float, float)]
1021+
let identity = x =>
1022+
switch x {
1023+
| #viewBox(a, b, c, d) =>
1024+
let a = a->Js.Float.toString
1025+
let b = b->Js.Float.toString
1026+
let c = c->Js.Float.toString
1027+
let d = d->Js.Float.toString
1028+
`${a} ${b} ${c} ${d}`
1029+
}
1030+
let fromOption = o => o->optionMap(identity)
1031+
}
9731032

9741033
include Chakra__Theme
9751034

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /