Skip to content

Commit 9a61f1e

Browse files
committed
Primera versión de la librería OK
1 parent ab19432 commit 9a61f1e

File tree

11 files changed

+14603
-8
lines changed

11 files changed

+14603
-8
lines changed

app-react/package-lock.json

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

app-react/src/App.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import React from 'react';
2-
import logo from './logo.svg';
32
import './App.css';
4-
3+
import { HelloFC, HelloCC, CustomBox } from '@mugan86/react-basic-library';
54
function App() {
65
return (
76
<div className="App">
87
<header className="App-header">
9-
<img src={logo} className="App-logo" alt="logo" />
8+
<CustomBox content="Anartz" bgColor="blue" width="400px" height="300px"/>
109
<p>
1110
Anartz Mugika Ledo - [email protected].
1211
</p>
12+
<HelloFC name="Anartz"/>
13+
<HelloCC name="Holaaaaaa" lastname="hdhdhdhd"/>
1314
<a
1415
className="App-link"
1516
href="https://reactjs.org"

lib-react/lib/custom-box.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference types="react" />
2+
declare const CustomBox: (props: any) => JSX.Element;
3+
export default CustomBox;

lib-react/lib/custom-box.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
11
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
const react_1 = __importDefault(require("react"));
7+
const CustomBox = (props) => {
8+
const { width, height, bgColor, content, color } = props;
9+
const showText = (!content) ? 'Texto de ejemplo' : content;
10+
return (react_1.default.createElement("div", { style: {
11+
width: width || 200,
12+
height: height || 200,
13+
backgroundColor: bgColor || "green",
14+
color: color || "white",
15+
} }, showText));
16+
};
17+
exports.default = CustomBox;

lib-react/lib/hello-cc.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
/** class component */
1+
/** class component */
2+
import React from 'react';
3+
declare class HelloCC extends React.Component {
4+
name: string;
5+
lastname: string;
6+
constructor(props: any);
7+
render(): JSX.Element;
8+
}
9+
export default HelloCC;

lib-react/lib/hello-cc.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
11
"use strict";
2-
/** class component */
2+
/** class component */
3+
var __importDefault = (this && this.__importDefault) || function (mod) {
4+
return (mod && mod.__esModule) ? mod : { "default": mod };
5+
};
6+
Object.defineProperty(exports, "__esModule", { value: true });
7+
const react_1 = __importDefault(require("react"));
8+
class HelloCC extends react_1.default.Component {
9+
constructor(props) {
10+
super(props);
11+
this.name = (!props.name) ? '-->>' : props.name;
12+
this.lastname = (!props.lastname) ? '....' : props.lastname;
13+
}
14+
render() {
15+
return react_1.default.createElement("h1", null,
16+
"Hola ",
17+
this.name,
18+
" ",
19+
this.lastname,
20+
" desde CC");
21+
}
22+
}
23+
exports.default = HelloCC;

lib-react/lib/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/** Aquí vamos a importar todos los componentes para usarlo en la aplicación */
22
import HelloFC from './hello-fc';
3-
export { HelloFC };
3+
import HelloCC from './hello-cc';
4+
import CustomBox from './custom-box';
5+
export { HelloFC, HelloCC, CustomBox };

lib-react/lib/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
66
Object.defineProperty(exports, "__esModule", { value: true });
77
const hello_fc_1 = __importDefault(require("./hello-fc"));
88
exports.HelloFC = hello_fc_1.default;
9+
const hello_cc_1 = __importDefault(require("./hello-cc"));
10+
exports.HelloCC = hello_cc_1.default;
11+
const custom_box_1 = __importDefault(require("./custom-box"));
12+
exports.CustomBox = custom_box_1.default;

lib-react/src/custom-box.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
3+
const CustomBox = (props: any) => {
4+
const { width, height, bgColor, content, color } = props;
5+
const showText = (!content)? 'Texto de ejemplo': content;
6+
return (
7+
<div
8+
style={
9+
{
10+
width: width || 200,
11+
height: height || 200,
12+
backgroundColor: bgColor || "green",
13+
color: color || "white",
14+
}
15+
}>
16+
{ showText}
17+
</div>
18+
)
19+
}
20+
21+
export default CustomBox;

lib-react/src/hello-cc.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
/** class component */
1+
/** class component */
2+
3+
import React from 'react';
4+
5+
class HelloCC extends React.Component {
6+
name: string;
7+
lastname: string;
8+
constructor(props: any) {
9+
super(props);
10+
this.name = (!props.name) ? '-->>': props.name;
11+
this.lastname = (!props.lastname) ? '....': props.lastname;
12+
}
13+
render() {
14+
return <h1>Hola {this.name} {this.lastname} desde CC</h1>
15+
}
16+
}
17+
18+
export default HelloCC;

lib-react/src/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/** Aquí vamos a importar todos los componentes para usarlo en la aplicación */
22

33
import HelloFC from './hello-fc';
4+
import HelloCC from './hello-cc';
5+
import CustomBox from './custom-box';
6+
export { HelloFC, HelloCC, CustomBox };
47

5-
export { HelloFC };

0 commit comments

Comments
 (0)