Skip to content

Commit

Permalink
style: 💄 color change
Browse files Browse the repository at this point in the history
  • Loading branch information
Loonz806 committed Aug 27, 2024
1 parent 10a7cbb commit 5c56912
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
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;
}

0 comments on commit 5c56912

Please sign in to comment.