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

Added Errors component #731

Merged
merged 4 commits into from
Aug 4, 2020
Merged

Added Errors component #731

merged 4 commits into from
Aug 4, 2020

Conversation

ale-kacperczyk
Copy link
Collaborator

🚀 Links

📓 Description

Created a new component - Errors. It mirrors the Scopes component.

👷 Type of change (remove not needed)

Features (for the website)

  • New feature

Copy link
Collaborator

@jakubsikora jakubsikora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Few comments.

Comment on lines 7 to 16
const formattedErrors = allErrors.map((error) => {
const newError = ERRORS.find((item) => item.id === error);
return newError;
}).map((error) => {
const errorArray = [];
errorArray.push(<code className="language-text">{error.id}</code>)
errorArray.push(error.message)
errorArray.push(error.description)
return errorArray;
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good, but let's make it better to avoid double iteration :)

Suggested change
const formattedErrors = allErrors.map((error) => {
const newError = ERRORS.find((item) => item.id === error);
return newError;
}).map((error) => {
const errorArray = [];
errorArray.push(<code className="language-text">{error.id}</code>)
errorArray.push(error.message)
errorArray.push(error.description)
return errorArray;
})
const formattedErrors = allErrors.map((error) => {
const newError = ERRORS.find((item) => item.id === error);
return [
<code className="language-text">{newError.id}</code>,
newError.message,
newError.description
];
})

`;

const Scopes = ({ title, scopes }) => {
const Scopes = ({ scopes }) => {
const allScopes = scopes.split(",");
const formattedScopes = allScopes.map((scope) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as above

import React from "react";
import PropTypes from "prop-types";
import styled from "@emotion/styled";
import { v4 as uuidv4 } from 'uuid';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely :)

Copy link
Collaborator

@jakubsikora jakubsikora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@ale-kacperczyk ale-kacperczyk merged commit 4a41154 into master Aug 4, 2020
@ale-kacperczyk ale-kacperczyk deleted the feature/dps-2201 branch August 4, 2020 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants