summaryrefslogtreecommitdiff
path: root/bs5/universal/native/shared/Link.re
blob: c4965a527a5467624908d5bd9b29de5c1f4c33fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
let defaultSize = Text.Medium;

module Base = {
  [@react.component]
  let make = (~size, ~color, ~href, ~children, ~underline, ~target=?) => {
    <a
      href
      ?target
      className={Cx.make([
        Text.size_to_string(size),
        "inline-flex items-center",
        underline ? "underline" : "",
        "transition-colors duration-250 ease-out",
        Theme.text(color),
        Theme.hover([
          Theme.text(Theme.Color.oneScaleUp(color)),
          underline ? "underline" : "",
        ]),
      ])}>
      children
    </a>;
  };
};

module Text = {
  [@react.component]
  let make =
      (
        ~color=Theme.Color.Gray12,
        ~size=defaultSize,
        ~href,
        ~children,
        ~target=?,
      ) => {
    <Base size href color ?target underline=true>
      {React.string(children)}
    </Base>;
  };
};

module WithArrow = {
  [@react.component]
  let make =
      (
        ~color=Theme.Color.Gray13,
        ~size=defaultSize,
        ~href,
        ~children,
        ~target=?,
      ) => {
    <Base size href color ?target underline=false>
      {React.array([|
        React.string(children),
        <Arrow />
      |])}
    </Base>;
  };
};