Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retos Completados #109

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15,425 changes: 15,425 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

87 changes: 29 additions & 58 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,36 @@
{
"name": "frontend-test",
"version": "1.0.0",
"description": "frontend test",
"main": "index.js",
"scripts": {
"build": "webpack --mode production",
"start": "webpack-dev-server --open --mode development",
"server": "json-server data.json",
"format": "prettier --write '{*.js,src/**/*.{js,jsx}}'",
"lint": "eslint src/ --fix",
"test": "jest"
},
"keywords": [
"react",
"webpack"
],
"author": "Oscar Barajas <[email protected]>",
"license": "MIT",
"dependencies": {
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.7.1",
"@babel/preset-react": "^7.8.3",
"babel-loader": "^8.0.6",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.2",
"enzyme": "^3.11.0",
"jest-fetch-mock": "^3.0.1",
"enzyme-adapter-react-16": "^1.15.2"
"@types/react-router-dom": "^5.3.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.8.2",
"react-scripts": "^5.0.1"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"css-loader": "^3.4.2",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.6.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.2",
"husky": "^2.7.0",
"jest": "^25.1.0",
"json-server": "^0.15.1",
"mini-css-extract-plugin": "^0.7.0",
"prettier": "^1.19.1",
"style-loader": "^0.23.1",
"stylus": "^0.54.7",
"stylus-loader": "^3.0.2"
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"jest": {
"verbose": true,
"moduleNameMapper": {
"\\.(styl|css)$": "<rootDir>/src/__mocks__/styleMock.js"
},
"setupFilesAfterEnv": [
"<rootDir>/src/__test__/setupTest.js"
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"eslint": "^8.2.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.3.0"
}
}
13 changes: 8 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<!DOCTYPE html>
<html lang="es">
<head>
<head>
<meta charset="utf-8" />
<title>React Base</title>
<!-- fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Noto+Color+Emoji&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="app"></div>
</body>
</html>
Binary file added public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions src/__test__/components/About.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import React from 'react';
import { mount } from 'enzyme';
import About from '../../components/About';
import { data } from '../../../data.json';

describe('<About />', () => {
const about = mount(<About />);
const about = mount(<About data={data} />);

test('About render', () => {
expect(about.length).toEqual(1);
});

test('About title', () => {
expect(about.find('.About-title').length).toEqual(1);
});

@@ -16,5 +17,4 @@ describe('<About />', () => {
test('About haves 3 items', () => {
expect(about.find('.About-item').length).toBeGreaterThan(2);
});

});
});
20 changes: 20 additions & 0 deletions src/__test__/components/Courses.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import { mount } from 'enzyme';
import Courses from '../../components/Courses';
import { data } from '../../../data.json';

describe('<Courses />', () => {
const academic = mount(<Courses data={data} />);

test('Courses render', () => {
expect(academic.length).toEqual(1);
});

test('Courses title', () => {
expect(academic.find('.Courses-title').length).toEqual(1);
});

test('Courses has 3 items', () => {
expect(academic.find('.Courses-item').length).toBeGreaterThan(2);
});
});
7 changes: 4 additions & 3 deletions src/__test__/components/Header.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React from 'react';
import { mount } from 'enzyme';
import Header from '../../components/Header';
import { data } from '../../../data.json';

describe('<Header />', () => {
const header = mount(<Header />);
const header = mount(<Header data={data} />);

test('Header render', () => {
expect(header.length).toEqual(1);
});

@@ -12,5 +13,4 @@ describe('<Header />', () => {
test('Header title', () => {
expect(header.find('.Header-title').length).toEqual(1);
});

});
});
13 changes: 4 additions & 9 deletions src/__test__/components/Interest.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import React from 'react';
import { mount } from 'enzyme';
import Interest from '../../components/Interest';
import { data } from '../../../data.json';

describe('<Interest />', () => {
const interest = mount(<Interest />);
const interest = mount(<Interest data={data} />);

test('Interest render', () => {
expect(interest.length).toEqual(1);
});

test('Interest title', () => {
expect(interest.find('.Interest-title').length).toEqual(1);
});

@@ -16,5 +17,4 @@ describe('<Interest />', () => {
test('Interest has 3 items', () => {
expect(interest.find('.Interest-item').length).toBeGreaterThan(2);
});

});
});
10 changes: 6 additions & 4 deletions src/__test__/components/Languages.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import React from 'react';
import { mount } from 'enzyme';
import Languages from '../../components/Languages';
import { data } from '../../../data.json';

describe('<Languages />', () => {
const languages = mount(<Languages />);
const languages = mount(<Languages data={data} />);

test('Languages render', () => {
expect(languages.length).toEqual(1);
});

test('Languages title', () => {
@@ -13,8 +14,7 @@ describe('<Languages />', () => {
expect(languages.find('.Languages-title').length).toEqual(1);
});

test('Languages has 3 items', () => {
expect(languages.find('.Languages-item').length).toBeGreaterThan(2);
test('Languages has more than 1 items', () => {
expect(languages.find('.Languages-item').length).toBeGreaterThan(1);
});

});
});
11 changes: 4 additions & 7 deletions src/__test__/components/Profile.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import React from 'react';
import { mount } from 'enzyme';
import Profile from '../../components/Profile';
import { data } from '../../../data.json';

describe('<Profile />', () => {
const profile = mount(<Profile />);
const profile = mount(<Profile data={data} />);

test('Profile render', () => {
expect(profile.length).toEqual(1);
});

test('Profile title', () => {
expect(profile.find('.Profile-title').length).toEqual(1);
});

@@ -16,5 +17,4 @@ describe('<Profile />', () => {
test('Profile have a description', () => {
expect(profile.find('.Profile-desc').length).toEqual(1);
});

});
});
20 changes: 20 additions & 0 deletions src/__test__/components/Projects.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import { mount } from 'enzyme';
import Projects from '../../components/Projects';
import { data } from '../../../data.json';

describe('<Projects />', () => {
const experience = mount(<Projects data={data} />);

test('Projects render', () => {
expect(experience.length).toEqual(1);
});

test('Projects title', () => {
expect(experience.find('.Projects-title').length).toEqual(1);
});

test('Projects haves 3 items', () => {
expect(experience.find('.Projects-item').length).toBeGreaterThan(2);
});
});
11 changes: 4 additions & 7 deletions src/__test__/components/Skills.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import React from 'react';
import { mount } from 'enzyme';
import Skills from '../../components/Skills';
import { data } from '../../../data.json';

describe('<Skills />', () => {
const skills = mount(<Skills />);
const skills = mount(<Skills data={data} />);

test('Skills render', () => {
expect(skills.length).toEqual(1);
});

test('Skills title', () => {
expect(skills.find('.Skills-title').length).toEqual(1);
});

@@ -16,5 +17,4 @@ describe('<Skills />', () => {
test('Skills has 3 items', () => {
expect(skills.find('.Skills-item').length).toBeGreaterThan(2);
});

});
});
34 changes: 34 additions & 0 deletions src/components/About.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';

function About({ data }) {
return (
<section className='About'>
<h2 className='About-title'>
{data.name}
&nbsp;
<span>{data.profession}</span>
</h2>

<span>
<span className='emoji' role='img' aria-label='Mexico flag'>
🇲🇽
</span>
{data.address}
</span>

<ul className='About-social'>
{data.social?.map(({ name, url }) => (
<li key={name} className='About-item'>
<a href={url}>{name}</a>
</li>
))}

<li className='About-item'>
<a href={`mailto:${data.email}`}>{data.email}</a>
</li>
</ul>
</section>
);
}

export default About;
21 changes: 21 additions & 0 deletions src/components/Courses.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';

function Courses({ data }) {
return (
<section className='Courses'>
<h2 className='Courses-title'>Courses</h2>

<div className='Courses-list'>
{data.courses?.map(({ name, institution }) => (
<article key={name} className='Courses-item'>
<h3 className='Courses-item-title'>{name}</h3>

<span className='Courses-item-details'>{institution}</span>
</article>
))}
</div>
</section>
);
}

export default Courses;
21 changes: 21 additions & 0 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable react/jsx-one-expression-per-line */
import React from 'react';

function Header({ children, data }) {
return (
<header className='Header'>
<img
src={data.avatar}
width='156'
alt='Avatar'
className='Header-avatar'
/>

<h1 className='Header-title sr-only'>{data.name} CV</h1>

{children}
</header>
);
}

export default Header;
Loading