جواب «Step 3: Skills» چالش 3 از جلسهی 5
سؤال
کامپوننت Skills را بنویس: یک div با id برابر skills و کلاس row که سه span با کلاس badge داخلش است. متن آنها به ترتیب: HTML، CSS، React
بعد <Skills /> را زیر <Bio /> بگذار.
راهنما
هر نشان این شکلی است: <span className="badge">HTML</span>. هر سه را داخل <div id="skills" className="row"> بگذار.
یک جواب درست
<style>
body { font-family: sans-serif; text-align: center; padding: 16px; }
button, input, select { font-size: 16px; min-height: 40px; margin: 4px; }
.card { max-width: 260px; margin: 12px auto; padding: 16px; border: 2px solid #334155; border-radius: 16px; background: #f8fafc; }
.avatar { font-size: 64px; }
.badge { display: inline-block; margin: 4px; padding: 4px 12px; border-radius: 999px; background: #bae6fd; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
</style>
<div id="root" dir="ltr"></div>
<script type="text/jsx">
import { createRoot } from "react-dom/client";
function Avatar() {
return <p className="avatar">🦊</p>;
}
function Name() {
return <h2 id="name">Sara</h2>;
}
function Bio() {
const age = 13;
const city = "Tabriz";
return <p id="bio">{age} years old, from {city}</p>;
}
function Skills() {
return (
<div id="skills" className="row">
<span className="badge">HTML</span>
<span className="badge">CSS</span>
<span className="badge">React</span>
</div>
);
}
function App() {
return (
<div id="card" className="card">
<Avatar />
<Name />
<Bio />
<Skills />
</div>
);
}
createRoot(document.getElementById("root")).render(<App />);
</script>
اول خودت امتحان کن؛ جوابهای دیگر هم قبول است. برگرد و خودت حلش کن