Skip to content

Commit 3c512b8

Browse files
authored
Merge pull request #96 from lumihq/kimi/update/tooltip
[update] tooltip to accept JSX
2 parents 3c651ce + 3257da0 commit 3c512b8

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

docs/Examples/Tooltip.example.purs

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ import Data.Maybe (Maybe(..))
66
import Data.Nullable (toNullable)
77
import Lumi.Components.Size (Size(..))
88
import Lumi.Components.Column (column_)
9+
import Lumi.Components.Link as Link
910
import Lumi.Components.Row (row_)
1011
import Lumi.Components.Text (body_)
12+
import Lumi.Components.Text as T
1113
import Lumi.Components.Example (example)
1214
import Lumi.Components.Tooltip (tooltip)
1315
import React.Basic (JSX)
1416
import React.Basic.DOM as R
17+
import Web.HTML.History (URL(..))
1518

1619
docs :: JSX
1720
docs =
@@ -20,7 +23,7 @@ docs =
2023
$ tooltip
2124
{ variant: "basic"
2225
, style: R.css {}
23-
, text: "Lorem ipsum"
26+
, text: R.text "Lorem ipsum"
2427
, content: body_ "Basic example"
2528
, size: toNullable Nothing
2629
}
@@ -29,7 +32,7 @@ docs =
2932
$ tooltip
3033
{ variant: "top"
3134
, style: R.css {}
32-
, text: "Lorem ipsum"
35+
, text: R.text "Lorem ipsum"
3336
, content: body_ "Top example"
3437
, size: toNullable Nothing
3538
}
@@ -38,7 +41,7 @@ docs =
3841
$ tooltip
3942
{ variant: "bottom"
4043
, style: R.css {}
41-
, text: "Lorem ipsum"
44+
, text: R.text "Lorem ipsum"
4245
, content: body_ "Bottom example"
4346
, size: toNullable Nothing
4447
}
@@ -47,7 +50,7 @@ docs =
4750
$ tooltip
4851
{ variant: "left"
4952
, style: R.css {}
50-
, text: "Lorem ipsum"
53+
, text: R.text "Lorem ipsum"
5154
, content: body_ "Left example"
5255
, size: toNullable Nothing
5356
}
@@ -58,7 +61,7 @@ docs =
5861
, tooltip
5962
{ variant: "top"
6063
, style: R.css { padding: "0 2px", textDecoration: "underline" }
61-
, text: "Lorem ipsum"
64+
, text: R.text "Lorem ipsum"
6265
, content: body_ "here"
6366
, size: toNullable Nothing
6467
}
@@ -71,10 +74,35 @@ docs =
7174
, tooltip
7275
{ variant: "top"
7376
, style: R.css { padding: "0 2px", textDecoration: "underline" }
74-
, text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis auctor libero non libero consequat, at iaculis diam venenatis. Donec nec porttitor tellus."
77+
, text: R.text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis auctor libero non libero consequat, at iaculis diam venenatis. Donec nec porttitor tellus."
7578
, content: body_ "here"
7679
, size: toNullable $ Just $ Large
7780
}
7881
, body_ "for more."
7982
]
83+
84+
, example
85+
$ row_
86+
[ body_ "Hello, world see"
87+
, tooltip
88+
{ variant: "top"
89+
, style: R.css { padding: "0 2px", textDecoration: "underline" }
90+
, text:
91+
T.text T.body
92+
{ style = R.css {}
93+
, children =
94+
[ R.text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis auctor libero non libero consequat, at iaculis diam venenatis. Donec nec porttitor tellus "
95+
, Link.link Link.defaults
96+
{ href = URL "#/link"
97+
, text = R.text "click here"
98+
, target = Just "_blank"
99+
}
100+
, R.text "."
101+
]
102+
}
103+
, content: body_ "here"
104+
, size: toNullable $ Just $ Large
105+
}
106+
, body_ "for more (includes link in tooltip)."
107+
]
80108
]

src/Lumi/Components/Tooltip.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import React.Basic.DOM (CSS, unsafeCreateDOMComponent)
1414
type TooltipProps =
1515
{ variant :: String
1616
, style :: CSS
17-
, text :: String
17+
, text :: JSX
1818
, content :: JSX
1919
, size :: Nullable Size
2020
}

0 commit comments

Comments
 (0)