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

style: 💄 color change #46

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ yarn-error.log*
# IDE's
.vscode
.idea
src/components
18 changes: 11 additions & 7 deletions src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, { Suspense, lazy } from "react";
import ErrorBoundary from "./ErrorBoundary";
import Fallback from "./Fallback";
const Counter = lazy(() => import("./Counter"));

const App = () => {
Expand All @@ -7,14 +9,16 @@ const App = () => {
<div>
<header>
{/* messing up on purpose */}
<h1>{testMessage}</h1>
<h1 className="red">{testMessage}</h1>
</header>
<Suspense fallback={<div>Loading...</div>}>
{/* another mistake */}
<main id="content">
<Counter />
</main>
</Suspense>
<ErrorBoundary fallback={Fallback}>
<Suspense fallback={<div>Loading...</div>}>
{/* another mistake */}
<main id="content">
<Counter />
</main>
</Suspense>
</ErrorBoundary>
</div>
);
};
Expand Down
19 changes: 19 additions & 0 deletions src/components/Fallback.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import PropTypes from "prop-types";

const Fallback = ({ message, criticalRenderPath }) => {
return (
<div data-testid="default-fallback">
{criticalRenderPath && (
<p>{message || "Something went wrong, please retry"}</p>
)}
</div>
);
};

Fallback.propTypes = {
message: PropTypes.string,
criticalRenderPath: PropTypes.bool,
};

export default Fallback;
3 changes: 3 additions & 0 deletions src/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ button {
margin-right: 16px;
}

.red {
color: red;
}
Loading