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

feat: add reusable card component workshop #629

Merged
merged 1 commit into from
Oct 7, 2024
Merged
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
53 changes: 53 additions & 0 deletions frontend-cert/react-projects/resuable-profile-component/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Reusable Card component</title>
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>

<!-- Don't use this in production: -->
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<link rel="stylesheet" href="./styles.css" />
</head>
<body>
<div id="root"></div>
<script type="text/babel">
function Card({ name, title, bio }) {
return (
<div className="card">
<h2>{name}</h2>
<p className="card-title">{title}</p>
<p>{bio}</p>
</div>
);
}

function App() {
return (
<div className="flex-container">
<Card
name="Mark"
title="Frontend developer"
bio="I like to work with different frontend technologies and play video games."
/>
<Card
name="Tiffany"
title="Engineering manager"
bio="I have worked in tech for 15 years and love to help people grow in this industry."
/>
<Card
name="Doug"
title="Backend developer"
bio="I have been a software developer for over 20 years and I love working with Go and Rust."
/>
</div>
);
}

const container = document.getElementById("root");
const root = ReactDOM.createRoot(container);
root.render(<App />);
</script>
</body>
</html>
36 changes: 36 additions & 0 deletions frontend-cert/react-projects/resuable-profile-component/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
:root {
--dark-grey: #1b1b32;
--light-grey: #f5f6f7;
--dark-orange: #f89808;
}

body {
background-color: var(--dark-grey);
}

.flex-container {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
}

.card {
border: 5px solid var(--dark-orange);
border-radius: 10px;
width: 100%;
padding: 20px;
margin: 10px 0;
background-color: var(--light-grey);
}

.card-title {
border-bottom: 4px solid var(--dark-orange);
width: fit-content;
}

@media (min-width: 768px) {
.card {
width: 300px;
}
}