Skip to content

Commit deefd64

Browse files
committed
init base
1 parent 059e004 commit deefd64

File tree

23 files changed

+310
-50
lines changed

23 files changed

+310
-50
lines changed

.storybook/addons.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import "@storybook/addon-actions/register";
2+
import "@storybook/addon-links/register";

.storybook/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { configure } from "@storybook/react";
2+
3+
// import default styles
4+
import "../src/styles";
5+
6+
// automatically import all files ending in *.stories.js
7+
configure(require.context("../src/stories", true, /\.stories\.js$/), module);

package.json

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"scripts": {
66
"build": "react-app-rewired build",
77
"start": "react-app-rewired start",
8-
"test": "react-app-rewired test --watchAll=false"
8+
"test": "react-app-rewired test --watchAll=false",
9+
"storybook": "start-storybook -p 9009 -s public",
10+
"build-storybook": "build-storybook -s public"
911
},
1012
"browserslist": {
1113
"production": [
@@ -23,15 +25,26 @@
2325
"extends": "react-app"
2426
},
2527
"dependencies": {
26-
"@testing-library/jest-dom": "^4.2.4",
27-
"@testing-library/react": "^9.4.0",
28-
"@testing-library/user-event": "^8.0.2",
28+
"@fortawesome/fontawesome-svg-core": "^1.2.26",
29+
"@fortawesome/free-solid-svg-icons": "^5.12.0",
30+
"@fortawesome/react-fontawesome": "^0.1.8",
31+
"bootstrap": "^4.4.1",
2932
"react": "^16.12.0",
33+
"react-bootstrap": "^1.0.0-beta.16",
3034
"react-dom": "^16.12.0",
3135
"react-scripts": "^3.3.0"
3236
},
3337
"devDependencies": {
38+
"@storybook/addon-actions": "^5.2.8",
39+
"@storybook/addon-links": "^5.2.8",
40+
"@storybook/addons": "^5.2.8",
41+
"@storybook/react": "^5.2.8",
42+
"@testing-library/dom": "^6.11.0",
43+
"@testing-library/jest-dom": "^4.2.4",
44+
"@testing-library/react": "^9.4.0",
45+
"@testing-library/react-hooks": "^3.2.1",
3446
"jest-tap-reporter": "^1.9.0",
35-
"react-app-rewired": "^2.1.5"
47+
"react-app-rewired": "^2.1.5",
48+
"react-test-renderer": "^16.12.0"
3649
}
3750
}

src/App.css

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

src/App.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
import React from "react";
2+
import Card from "react-bootstrap/Card";
3+
import { MessageForm } from "./components/MessageForm";
4+
import { USER } from "./config";
25

3-
const App = () => {
4-
return <div>Welcome to CodeRoad</div>;
5-
};
6+
const App = () => (
7+
<div className="App">
8+
<Card className="Home">
9+
<Card.Header className="Home_Title">Home</Card.Header>
10+
<Card.Body className="Home_Body">
11+
<MessageForm user={USER} />
12+
</Card.Body>
13+
</Card>
14+
</div>
15+
);
616

717
export default App;

src/components/Avatar/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from "react";
2+
import BootstrapImage from "react-bootstrap/Image";
3+
4+
export const Avatar = ({ image }) => (
5+
<BootstrapImage src={image} roundedCircle style={{ height: 49, width: 49 }} />
6+
);

src/components/Card/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from "react";
2+
3+
import BootstrapCard from "react-bootstrap/Card";
4+
import { Avatar } from "../Avatar";
5+
import "./styles.css";
6+
7+
export const Card = ({ children, profile_image, className, ...rest }) => {
8+
return (
9+
<BootstrapCard className={`Card ${className || ""}`} {...rest}>
10+
<div className="Card_LeftColumn">
11+
<Avatar image={profile_image} />
12+
</div>
13+
<div className="Card_RightColumn">{children}</div>
14+
</BootstrapCard>
15+
);
16+
};

src/components/Card/styles.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.Card {
2+
display: flex;
3+
flex-direction: row;
4+
padding: 1rem;
5+
width: 100%;
6+
}
7+
8+
.Card_LeftColumn {
9+
display: flex;
10+
width: 50px;
11+
justify-content: center;
12+
}
13+
14+
.Card_RightColumn {
15+
padding-left: 1rem;
16+
width: 100%;
17+
}

src/components/Icon/Button.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from "react";
2+
3+
export const IconButton = ({ children, className, ...rest }) => (
4+
<button className={`Icon_Button ${className}`} {...rest}>
5+
{children}
6+
</button>
7+
);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from "react";
2+
3+
export const IconCountWrapper = ({ children, count, ...rest }) => (
4+
<div className="Icon_Countable" {...rest}>
5+
{children}
6+
{count > 0 && <span className="Icon_Count">{count}</span>}
7+
</div>
8+
);

0 commit comments

Comments
 (0)