Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 4f869eb

Browse files
committed
Adding box, link and typography
1 parent 73bed34 commit 4f869eb

28 files changed

+603
-27
lines changed

.bsb.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
19168

.storybook/preview-head.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<link rel="preconnect" href="https://fonts.gstatic.com">
2+
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap" rel="stylesheet">
3+
<style>
4+
html {
5+
font-size: 10px;
6+
}
7+
</style>

src/App.bs.js

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.res

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
open Render
2-
31
GlobalStyles.includeStyle()
42

53
@react.component
64
let make = () => {
7-
<div> <Button> {s("Sign in")} </Button> </div>
5+
<div> <Link> {`Text`->React.string} </Link> </div>
86
}

src/MyText.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/bindings/Storybook.res

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,3 @@ type decorator = chapter => React.element
1010
external storiesOf: (string, storybookModule) => section = "storiesOf"
1111

1212
@send external add: (section, string, chapter) => section = "add"
13-
14-
@send external addDecorator: (section, decorator) => section = "addDecorator"

src/components/Box/Box.bs.js

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Box/Box.res

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module Int = Js.Int
2+
3+
type spacing = (int, int, int, int)
4+
5+
let toRem = value => value->Int.toFloat *. 0.8 |> Css.rem
6+
7+
let margins = ((top, left, bottom, right)) =>
8+
CssJs.margin4(~top=top->toRem, ~left=left->toRem, ~bottom=bottom->toRem, ~right=right->toRem)
9+
10+
let paddings = ((top, left, bottom, right)) =>
11+
CssJs.padding4(~top=top->toRem, ~left=left->toRem, ~bottom=bottom->toRem, ~right=right->toRem)
12+
13+
let box = (
14+
~direction as direction_,
15+
~align,
16+
~justify,
17+
~block as block_,
18+
~fullHeight,
19+
~margin as marginT,
20+
~padding as paddingT,
21+
) => {
22+
open CssJs
23+
24+
style(.[
25+
display(#flex),
26+
flexDirection(direction_),
27+
alignItems(align),
28+
justifyContent(justify),
29+
width(block_ ? 100.0->pct : auto),
30+
height(fullHeight ? 100.0->pct : auto),
31+
margins(marginT),
32+
paddings(paddingT),
33+
])
34+
}
35+
36+
@react.component
37+
let make = (
38+
~children,
39+
~direction=#row,
40+
~align=#center,
41+
~justify=#center,
42+
~block=true,
43+
~fullHeight=false,
44+
~margin=(0, 0, 0, 0),
45+
~padding=(0, 0, 0, 0),
46+
) => {
47+
<div className={box(~direction, ~align, ~justify, ~block, ~margin, ~padding, ~fullHeight)}>
48+
children
49+
</div>
50+
}

src/components/Button/Button.bs.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Button/Button.res

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
open CssJs
22

3+
style(.[
4+
display(#flexx)
5+
])
6+
37
let button = (~block) =>
48
style(.[
59
background(Theme.Colors.blue->hex),
@@ -14,4 +18,5 @@ let button = (~block) =>
1418
])
1519

1620
@react.component
17-
let make = (~children, ~block=false) => <button className={button(~block)}> children </button>
21+
let make = (~children, ~block=false, ~onClick) =>
22+
<button onClick className={button(~block)}> children </button>

0 commit comments

Comments
 (0)