Skip to content

Commit

Permalink
Merge pull request #27 from iranjunior/develop
Browse files Browse the repository at this point in the history
Update master
  • Loading branch information
iranjunior committed Apr 18, 2020
2 parents a971e47 + ad7c0bf commit 11fd92a
Show file tree
Hide file tree
Showing 27 changed files with 1,524 additions and 492 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/serviceWorker.js
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
},
"extends": [
"airbnb",
"plugin:jsx-a11y/recommended"
"plugin:jsx-a11y/recommended",
"plugin:import/errors",
"plugin:import/warnings"

],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
Expand All @@ -23,7 +27,8 @@
"plugins": [
"react",
"jsx-a11y",
"cypress"
"cypress",
"import"
],
"overrides": [
{
Expand Down
26 changes: 16 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
"private": true,
"homepage": "http://iranjunior.herokuapp.com",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@testing-library/jest-dom": "^5.5.0",
"@testing-library/react": "^10.0.2",
"@testing-library/user-event": "^10.0.2",
"axios": "^0.19.2",
"history": "^4.10.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-axe": "^3.4.1",
"react-dom": "^16.12.0",
"react-icons": "^3.9.0",
"react-lottie": "^1.2.3",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.1",
"react-scripts": "3.4.1",
"react-toastify": "^5.5.0",
"source-map-explorer": "^2.4.2",
"storybook-addon-styled-component-theme": "^1.3.0",
Expand Down Expand Up @@ -56,17 +57,22 @@
"@storybook/addon-links": "^5.3.13",
"@storybook/addon-viewport": "^5.3.14",
"@storybook/addons": "^5.3.13",
"@storybook/preset-create-react-app": "^1.5.2",
"@storybook/preset-create-react-app": "^2.1.1",
"@storybook/react": "^5.3.13",
"babel-eslint": "^10.1.0",
"coveralls": "^3.0.11",
"cypress": "^4.1.0",
"cross-env": "^7.0.2",
"cypress": "^4.4.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-cypress": "^2.10.3",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "^1.7.0"
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^3.0.0",
"husky": "^4.2.5",
"jest-canvas-mock": "^2.2.0",
"lint-staged": "^10.1.4"
},
"jest": {
"collectCoverageFrom": [
Expand Down
1 change: 1 addition & 0 deletions src/assets/loading.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"v":"5.1.1","fr":30,"ip":1,"op":39,"w":100,"h":100,"nm":"setting_loading 100px","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"loading","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2},"a":{"a":0,"k":[17,17,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-6.627,0],[0,0],[0,-6.627],[6.627,0],[0,6.627]],"o":[[0,0],[6.627,0],[0,6.627],[-6.627,0],[0,-6.627]],"v":[[0,-12],[0,-12],[12,0],[0,12],[-12,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.322000002394,0.62400004069,0.976000019148,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":4,"ix":5},"lc":2,"lj":2,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[17,17],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.75],"y":[1]},"o":{"x":[0.25],"y":[0]},"n":["0p75_1_0p25_0"],"t":0,"s":[0],"e":[100]},{"t":23}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.75],"y":[1]},"o":{"x":[0.25],"y":[0]},"n":["0p75_1_0p25_0"],"t":17,"s":[0],"e":[100]},{"t":40}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[382]},{"t":40}],"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":260,"st":0,"bm":0}],"markers":[]}
27 changes: 15 additions & 12 deletions src/components/simples/button/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ import PropTypes from 'prop-types';
import { MdVerticalAlignBottom } from 'react-icons/md';

import { TextButton, Button } from './styles';
import Boundary from '../erros/boundary';

const ButtonComponent = ({ getCurriculum, keyPressAction }) => (
<TextButton
role="button"
aria-label="Click aqui para baixar meu curriculo"
tabIndex={0}
onKeyPress={(event) => keyPressAction(event, getCurriculum)}
onClick={() => getCurriculum()}
>
Click aqui para baixar meu curriculo
<Button>
<MdVerticalAlignBottom size={30} />
</Button>
</TextButton>
<Boundary>
<TextButton
role="button"
aria-label="Click aqui para baixar meu curriculo"
tabIndex={0}
onKeyPress={(event) => keyPressAction(event, getCurriculum)}
onClick={() => getCurriculum()}
>
Click aqui para baixar meu curriculo
<Button>
<MdVerticalAlignBottom size={30} />
</Button>
</TextButton>
</Boundary>
);

ButtonComponent.propTypes = {
Expand Down
53 changes: 29 additions & 24 deletions src/components/simples/cards/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Card, Title, Subtitle, References, Reference, Links, CardHeader,
CardContent, TitleCard, DateCard, Content, Decision,
} from './styles';
import Boundary from '../erros/boundary';

const Cards = ({ data, type, keyPressAction }) => {
const [activeContent, setActiveContent] = useState(false);
Expand Down Expand Up @@ -47,16 +48,18 @@ const Cards = ({ data, type, keyPressAction }) => {
);
}
return (
<Card>
<CardHeader>
<TitleCard
aria-label={data.name}
tabIndex={0}
>
{data.name}
<Boundary>

</TitleCard>
{
<Card>
<CardHeader>
<TitleCard
aria-label={data.name}
tabIndex={0}
>
{data.name}

</TitleCard>
{
data.complete ? (
<DateCard
aria-label={`Concluido em ${data.date}`}
Expand All @@ -77,23 +80,25 @@ const Cards = ({ data, type, keyPressAction }) => {
</DateCard>
)
}
</CardHeader>
<CardContent active={activeContent}>
<Content
aria-label={data.description}
</CardHeader>
<CardContent active={activeContent}>
<Content
aria-label={data.description}
tabIndex={0}
>
{data.description}
</Content>
</CardContent>
<Decision
tabIndex={0}
onKeyPress={(event) => keyPressAction(event, toggleActive,
setActiveContent, activeContent)}
onClick={() => toggleActive(setActiveContent, activeContent)}
>
{data.description}
</Content>
</CardContent>
<Decision
tabIndex={0}
onKeyPress={(event) => keyPressAction(event, toggleActive, setActiveContent, activeContent)}
onClick={() => toggleActive(setActiveContent, activeContent)}
>
{activeContent ? 'Mostrar menos...' : 'Leia mais...'}
</Decision>
</Card>
{activeContent ? 'Mostrar menos...' : 'Leia mais...'}
</Decision>
</Card>
</Boundary>
);
};

Expand Down
15 changes: 9 additions & 6 deletions src/components/simples/description/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import PropTypes from 'prop-types';

import { getDescriptions } from '../../../services';
import Description from './styles';
import Boundary from '../erros/boundary';

const DescriptionComponent = ({ type }) => (
<Description
aria-label={`description-${type}`}
tabIndex={0}
>
{getDescriptions(type)}
</Description>
<Boundary>
<Description
aria-label={`description-${type}`}
tabIndex={0}
>
{getDescriptions(type)}
</Description>
</Boundary>
);

DescriptionComponent.propTypes = {
Expand Down
15 changes: 9 additions & 6 deletions src/components/simples/destak/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import React from 'react';
import PropTypes from 'prop-types';

import Destak from './styles';
import Boundary from '../erros/boundary';

const DestakComponent = ({ message }) => (
<Destak
tabIndex={0}
aria-label={message}
>
{message}
</Destak>
<Boundary>
<Destak
tabIndex={0}
aria-label={message}
>
{message}
</Destak>
</Boundary>
);

DestakComponent.propTypes = {
Expand Down
18 changes: 18 additions & 0 deletions src/components/simples/erros/__tests__/notfound.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { render } from '@testing-library/react';
import light from '../../../../styles/themes/light';

import NotFound from '../notfound';

const decorator = (Component) => (<ThemeProvider theme={light}>{Component}</ThemeProvider>);

describe('Test NotFound ', () => {
it('Should render NotFound with success', () => {
const wrapper = render(
decorator(<NotFound />),
);

expect(wrapper.container.textContent).toBe('Pagina não encontrada');
});
});
31 changes: 31 additions & 0 deletions src/components/simples/erros/boundary.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable react/destructuring-assignment */
import React from 'react';
import PropType from 'prop-types';

export default class Boundary extends React.Component {
constructor(props) {
super(props);
this.state = {
error: false,
};
}

static getDerivedStateFromError() {
return { error: true };
}

componentDidCatch() {

}

render() {
if (this.state.error) {
return <span>Ops, try reloading a page</span>;
}
return this.props.children;
}
}

Boundary.propTypes = {
children: PropType.element.isRequired,
};
12 changes: 12 additions & 0 deletions src/components/simples/erros/notfound.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

const styles = {
display: 'flex', flex: '1', alignItems: 'center', justifyContent: 'center', padding: '100px',
};
export default function NotFound() {
return (
<div style={styles}>
<h1>Pagina não encontrada</h1>
</div>
);
}
26 changes: 14 additions & 12 deletions src/components/simples/futureSkills/index.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import React, { memo } from 'react';
import propTypes from 'prop-types';

import Boundary from '../erros/boundary';

import { Container, FutureSkills } from './styles';

const SkillsComponent = ({ futureSkills }) => (
<Container>
{futureSkills.map((futureSkill) => (
<FutureSkills
tabIndex={0}
aria-label={futureSkill}
key={futureSkill}
>
{futureSkill}
</FutureSkills>
))}
</Container>
<Boundary>
<Container>
{futureSkills.map((futureSkill) => (
<FutureSkills
tabIndex={0}
aria-label={futureSkill}
key={futureSkill}
>
{futureSkill}
</FutureSkills>
))}
</Container>
</Boundary>
);
SkillsComponent.defaultProps = {
futureSkills: [],
Expand Down
9 changes: 6 additions & 3 deletions src/components/simples/icons/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';

import Container from './styles';
import Boundary from '../erros/boundary';

const IconsComponents = ({ icons, redirect, keyPressAction }) => (
<Container>
{
<Boundary>
<Container>
{
icons.map((icon) => (
<icon.icon
role="button"
Expand All @@ -18,7 +20,8 @@ const IconsComponents = ({ icons, redirect, keyPressAction }) => (
/>
))
}
</Container>
</Container>
</Boundary>
);

IconsComponents.defaultProps = {
Expand Down
5 changes: 3 additions & 2 deletions src/components/simples/imageProfile/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import {
import Button from '../button';

import profile from '../../../assets/profile.jpg';
import Boundary from '../erros/boundary';

const ImageComponent = ({ getCurriculum, keyPressAction }) => (
<>
<Boundary>
<Image alt="foto do iran" src={profile} />
<WrapperButton>
<Button keyPressAction={keyPressAction} getCurriculum={getCurriculum} />
</WrapperButton>
</>
</Boundary>
);
ImageComponent.propTypes = {
getCurriculum: Proptypes.func.isRequired,
Expand Down
Loading

0 comments on commit 11fd92a

Please sign in to comment.