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

Commit 2e18155

Browse files
committed
Adding Button component
1 parent f9af250 commit 2e18155

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3470
-263
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24+
.merlin
25+
/lib

.merlin

-18
This file was deleted.

.storybook/main.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
"stories": [
3+
"../src/**/*_Stories.js"
4+
],
5+
"addons": [
6+
"@storybook/addon-links",
7+
"@storybook/addon-essentials",
8+
"@storybook/preset-create-react-app"
9+
]
10+
}

.storybook/preview.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
export const parameters = {
3+
actions: { argTypesRegex: "^on[A-Z].*" },
4+
controls: {
5+
matchers: {
6+
color: /(background|color)$/i,
7+
date: /Date$/,
8+
},
9+
},
10+
}

bsconfig.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@
1414
}
1515
],
1616
"suffix": ".bs.js",
17-
"bs-dependencies": ["@rescript/react", "bs-css-emotion", "bs-css"]
17+
"bs-dependencies": [
18+
"@rescript/react",
19+
"bs-css-emotion",
20+
"bs-css",
21+
"bs-storybook"
22+
]
1823
}

lib/bs/.bsbuild

-78 Bytes
Binary file not shown.

lib/bs/.bsdeps

-8
This file was deleted.

lib/bs/.compiler.log

-2
This file was deleted.

lib/bs/.ninja_log

-75
This file was deleted.

lib/bs/.sourcedirs.json

-1
This file was deleted.

lib/bs/build.ninja

-28
This file was deleted.

lib/bs/install.ninja

-26
This file was deleted.

lib/bs/src/App.ast

-777 Bytes
Binary file not shown.

lib/bs/src/App.cmi

-1005 Bytes
Binary file not shown.

lib/bs/src/App.cmj

-81 Bytes
Binary file not shown.

lib/bs/src/App.cmt

-6.83 KB
Binary file not shown.

lib/bs/src/App.d

-1
This file was deleted.
-938 Bytes
Binary file not shown.
-1010 Bytes
Binary file not shown.
-99 Bytes
Binary file not shown.
-6.51 KB
Binary file not shown.

lib/bs/src/components/Button/Button.d

-1
This file was deleted.

lib/bs/src/index.ast

-737 Bytes
Binary file not shown.

lib/bs/src/index.cmi

-646 Bytes
Binary file not shown.

lib/bs/src/index.cmj

-68 Bytes
Binary file not shown.

lib/bs/src/index.cmt

-5.83 KB
Binary file not shown.

lib/bs/src/index.d

-1
This file was deleted.

lib/bs/src/lib/Helpers.ast

-318 Bytes
Binary file not shown.

lib/bs/src/lib/Helpers.cmi

-503 Bytes
Binary file not shown.

lib/bs/src/lib/Helpers.cmj

-72 Bytes
Binary file not shown.

lib/bs/src/lib/Helpers.cmt

-3 KB
Binary file not shown.

lib/bs/src/lib/Helpers.d

Whitespace-only changes.

lib/bs/src/lib/Render.ast

-232 Bytes
Binary file not shown.

lib/bs/src/lib/Render.cmi

-517 Bytes
Binary file not shown.

lib/bs/src/lib/Render.cmj

-82 Bytes
Binary file not shown.

lib/bs/src/lib/Render.cmt

-3.17 KB
Binary file not shown.

lib/bs/src/lib/Render.d

Whitespace-only changes.

package.json

+22-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@testing-library/user-event": "^12.1.10",
1010
"bs-css-emotion": "^2.5.1",
1111
"bs-platform": "8.4.2",
12+
"bs-storybook": "mishaszu/bs-storybook",
1213
"react": "^17.0.2",
1314
"react-dom": "^17.0.2",
1415
"react-scripts": "4.0.3",
@@ -21,12 +22,24 @@
2122
"start": "react-scripts start",
2223
"build": "react-scripts build",
2324
"test": "react-scripts test",
24-
"eject": "react-scripts eject"
25+
"eject": "react-scripts eject",
26+
"storybook": "start-storybook -p 6006 -s public",
27+
"build-storybook": "build-storybook -s public"
2528
},
2629
"eslintConfig": {
2730
"extends": [
2831
"react-app",
2932
"react-app/jest"
33+
],
34+
"overrides": [
35+
{
36+
"files": [
37+
"**/*.stories.*"
38+
],
39+
"rules": {
40+
"import/no-anonymous-default-export": "off"
41+
}
42+
}
3043
]
3144
},
3245
"jest": {
@@ -49,5 +62,12 @@
4962
"last 1 safari version"
5063
]
5164
},
52-
"devDependencies": {}
65+
"devDependencies": {
66+
"@storybook/addon-actions": "^6.2.9",
67+
"@storybook/addon-essentials": "^6.2.9",
68+
"@storybook/addon-links": "^6.2.9",
69+
"@storybook/node-logger": "^6.2.9",
70+
"@storybook/preset-create-react-app": "^3.1.7",
71+
"@storybook/react": "^6.2.9"
72+
}
5373
}

public/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1616
-->
1717
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<link rel="preconnect" href="https://fonts.gstatic.com">
19+
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap" rel="stylesheet">
1820
<!--
1921
Notice the use of %PUBLIC_URL% in the tags above.
2022
It will be replaced with the URL of the `public` folder during the build.

src/App.bs.js

+8-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.res

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
open Render
2+
3+
GlobalStyles.includeStyle()
4+
15
@react.component
26
let make = () => {
3-
<div> <Button /> </div>
7+
<div> <Button> {s("Sign in")} </Button> </div>
48
}

src/components/Button/Button.bs.js

+23-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Button/Button.res

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
open Render
1+
open CssJs
22

3-
Helpers.require("./button.css")
3+
let button = (~block) =>
4+
style(.[
5+
background(Theme.Colors.blue->hex),
6+
borderStyle(none),
7+
color(Theme.Colors.white->hex),
8+
height(5.5->rem),
9+
minWidth(block ? 100.0->pct : 20.0->rem),
10+
borderRadius(Theme.Radius.small),
11+
cursor(pointer),
12+
fontFamily(Theme.fontFamily),
13+
fontSize(2.0->rem),
14+
])
415

516
@react.component
6-
let make = () => <button> {s("Sign in")} </button>
17+
let make = (~children, ~block=false) => <button className={button(~block)}> children </button>

src/components/Button/button.css

-3
This file was deleted.

src/lib/GlobalStyles.bs.js

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/GlobalStyles.res

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
open CssJs
2+
3+
let includeStyle = () => {
4+
global(. "html, body, #root", [padding(zero), margin(zero), fontSize(10->px)])
5+
}

0 commit comments

Comments
 (0)