forked from 4GeeksAcademy/react-tutorial-exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.jsx
31 lines (28 loc) · 789 Bytes
/
app.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React from "react";
import ReactDOM from "react-dom";
import PropTypes from "prop-types";
const colorClasses = {
red: "alert-danger",
orange: "alert-warning",
};
const Alert = (props) => {
//your component here
return (
<div className={`alert ${colorClasses[props.color]}`} role="alert">
{props.text}
</div>
);
};
Alert.propTypes = {
color: PropTypes.string,
text: PropTypes.string,
};
// here is where the alert component is being used, you don't have to edit this part,
// but it helps you understand what properties are being passed to the component
ReactDOM.render(
<div>
<Alert text="OMG! Something really bad has happended!" color="red" />
<Alert text="Well, it is not that bad after all!" color="orange" />
</div>,
document.querySelector("#myDiv")
);