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

Commit 08bf1e0

Browse files
committed
Updating typography, input and link component
1 parent 3ac73cd commit 08bf1e0

16 files changed

+74
-41
lines changed

.storybook/preview-head.html

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

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
"@testing-library/react": "^11.1.0",
99
"@testing-library/user-event": "^12.1.10",
1010
"bs-css-emotion": "^2.5.1",
11-
"bs-platform": "8.4.2",
11+
"rescript": "9.1.3",
1212
"react": "^17.0.2",
1313
"react-dom": "^17.0.2",
1414
"react-scripts": "4.0.3",
1515
"web-vitals": "^1.0.1"
1616
},
1717
"scripts": {
18-
"res:watch": "bsb -make-world -w",
19-
"res:build": "bsb -make-world -clean",
20-
"res:clean": "bsb -clean",
18+
"res:watch": "rescript build -w",
19+
"res:build": "rescript build -with-deps",
20+
"res:clean": "rescript clean",
2121
"start": "react-scripts start",
2222
"build": "react-scripts build",
2323
"test": "react-scripts test",

src/components/Card/Card.res

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
open CssJs
22

3-
let card = style(.[
4-
//
3+
let card = style(. [
54
background(Theme.Colors.lightBlue1->hex),
65
borderRadius(Theme.Radius.medium),
76
padding(3.2->rem),
87
])
98

109
@react.component
1110
let make = (~children) => {
12-
<div className={card}>children</div>
11+
<div className={card}> children </div>
1312
}

src/components/Card/Card_Stories.bs.js

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

src/components/Card/Card_Stories.res

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ open Render
44
storiesOf("Card", Helpers.storybookModule)
55
->add("Basic usage", () => {
66
<Card>
7-
<Typography level=#h1 variant=#title>
8-
{"ReScript & React.js - Real World App"->s}
9-
</Typography>
10-
11-
<Typography>
12-
{"Texto"->s}
13-
</Typography>
7+
<Typography level=#1 variant=#title> {"ReScript & React.js - Real World App"->s} </Typography>
8+
<Typography> {"Texto"->s} </Typography>
149
</Card>
1510
})
1611
->ignore

src/components/Input/Input.bs.js

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

src/components/Link/Link.bs.js

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

src/components/Typography/Typography.bs.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
type variant = [#title | #text]
2-
type level = [#h1 | #h2]
2+
type level = [#1 | #2]
33

44
module Styles = {
55
open CssJs
66

7-
let h1 = style(.[
7+
let h1 = style(. [
88
fontSize(3.2->rem),
99
fontFamily(Theme.fontFamily),
1010
fontWeight(#bold),
1111
color(Theme.Colors.black->hex),
1212
])
1313

14-
let h2 = style(.[
14+
let h2 = style(. [
1515
fontSize(2.8->rem),
1616
fontFamily(Theme.fontFamily),
1717
fontWeight(#bold),
1818
color(Theme.Colors.black->hex),
1919
])
2020

21-
let text = style(.[
21+
let text = style(. [
2222
fontSize(2.0->rem),
2323
fontFamily(Theme.fontFamily),
2424
letterSpacing(-0.02->em),
@@ -27,10 +27,10 @@ module Styles = {
2727
}
2828

2929
@react.component
30-
let make = (~variant=#text, ~level: level=#h1, ~children) => {
30+
let make = (~variant=#text, ~level: level=#1, ~children) => {
3131
switch (variant, level) {
32-
| (#title, #h1) => <h1 className={Styles.h1}> children </h1>
33-
| (#title, #h2) => <h2 className={Styles.h2}> children </h2>
32+
| (#title, #1) => <h1 className={Styles.h1}> children </h1>
33+
| (#title, #2) => <h2 className={Styles.h2}> children </h2>
3434
| (#text, _) => <p className={Styles.text}> children </p>
3535
}
3636
}

src/components/Typography/Typography_Stories.bs.js

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

src/components/Typography/Typography_Stories.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ storiesOf("Typography", Helpers.storybookModule)
66
<Typography> {`Don’t have an account?`->s} </Typography>
77
})
88
->add("Title 1", () => {
9-
<Typography variant=#title level=#h1> {`Title 1`->s} </Typography>
9+
<Typography variant=#title level=#1> {`Title 1`->s} </Typography>
1010
})
1111
->add("Title 2", () => {
12-
<Typography variant=#title level=#h2> {`Title 2`->s} </Typography>
12+
<Typography variant=#title level=#2> {`Title 2`->s} </Typography>
1313
})
1414
->ignore

src/lib/Render.bs.js

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

src/lib/Render.res

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
let s = React.string
2+
3+
let map = (elements, fn) =>
4+
elements
5+
->Belt.Array.mapWithIndex((key, element) => fn(element, key->Belt.Int.toString))
6+
->React.array

src/lib/Theme.bs.js

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

src/lib/Theme.res

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
module Colors = {
2+
open CssJs
3+
24
let blue = "477BFF"
35
let white = "fff"
46
let gray1 = "A6AABE"
57
let gray2 = "AEB3C9"
68
let black = "14103D"
79
let lightBlue1 = "E2EAFF"
10+
let blueGradient = linearGradient(
11+
180.0->deg,
12+
list{(0.0->pct, "477BFF"->hex), (100.0->pct, "306AFF"->hex)},
13+
)
814
}
915

1016
module Radius = {
@@ -17,8 +23,7 @@ module Radius = {
1723

1824
module Spacing = {
1925
open CssJs
20-
21-
let xs = 0.8->rem
26+
let make = (value: int) => value->Js.Int.toFloat->(v => v *. 0.6)->rem
2227
}
2328

2429
let fontFamily = #custom("'DM Sans', sans-serif")

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4516,11 +4516,6 @@ [email protected]:
45164516
resolved "https://registry.yarnpkg.com/bs-css/-/bs-css-14.0.1.tgz#983394472d825c590a8f91230bfcb082e9474670"
45174517
integrity sha512-gNaKpU7sQKjyVCTgNa+ReHt0yAx19HcOYbGU4Sg7Jlv04NXK3FCvqffF60xb+x+jMMquOTLIj4VyQPiPSZ82Nw==
45184518

4519-
4520-
version "8.4.2"
4521-
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.4.2.tgz#778dabd1dfb3bc95e0086c58dabae74e4ebdee8a"
4522-
integrity sha512-9q7S4/LLV/a68CweN382NJdCCr/lOSsJR3oQYnmPK98ChfO/AdiA3lYQkQTp6T+U0I5Z5RypUAUprNstwDtMDQ==
4523-
45244519
45254520
version "2.1.1"
45264521
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05"
@@ -12299,6 +12294,11 @@ requires-port@^1.0.0:
1229912294
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
1230012295
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
1230112296

12297+
12298+
version "9.1.3"
12299+
resolved "https://registry.yarnpkg.com/rescript/-/rescript-9.1.3.tgz#1a0f41342acd8dc4e26fd1782d0997b8a7577698"
12300+
integrity sha512-TpfW3DakgCJtWbRvAek7cysuikBWarjqt8PrbFg0Rk3O+o4dt0inBdxyZe/+u3LOAWzyKK+2UlqC0xiCBgs6pQ==
12301+
1230212302
resolve-cwd@^2.0.0:
1230312303
version "2.0.0"
1230412304
resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"

0 commit comments

Comments
 (0)