css 第19集React Scrimba
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 第19集React Scrimba相关的知识,希望对你有一定的参考价值。
import React from "react";
import ContactCard from "./ContactCard";
function App() {
return (
<div className="contacts">
<ContactCard
contact={{
name: "Mr. Whiskerson",
imgUrl: "http://placekitten.com/300/200",
phone: "(212) 555-1234",
email: "mr.whiskaz@catnap.meow"
}}
/>
<ContactCard
contact={{
name: "Fluffykins",
imgUrl: "http://placekitten.com/400/200",
phone: "(212) 555-2345",
email: "fluff@me.com"
}}
/>
<ContactCard
contact={{
name: "Destroyer",
imgUrl: "http://placekitten.com/400/300",
phone: "(212) 555-3456",
email: "ofworlds@yahoo.com"
}}
/>
<ContactCard
contact={{
name: "Felix",
imgUrl: "http://placekitten.com/200/100",
phone: "(212) 555-4567",
email: "thecat@hotmail.com"
}}
/>
</div>
);
}
export default App;
import React from "react";
function ContactCard(props) {
console.log(props);
return (
<div className="contact-card">
<img src={props.contact.imgUrl} />
<h3>{props.contact.name}</h3>
<p>Phone: {props.contact.phone}</p>
<p>Email: {props.contact.email}</p>
</div>
);
}
export default ContactCard;
body {
margin: 0;
}
.contacts {
display: flex;
flex-wrap: wrap;
}
.contact-card {
flex-basis: 250px;
margin: 20px;
}
.contact-card > img {
width: 100%;
height: auto;
}
.contact-card > h3 {
text-align: center;
}
.contact-card > p {
font-size: 12px;
}
以上是关于css 第19集React Scrimba的主要内容,如果未能解决你的问题,请参考以下文章
css 第16集React Scrimba
javascript 第31集React Scrimba
javascript 第30集React Scrimba
javascript 第29集React Scrimba
javascript 第28集React Scrimba
javascript 第27集React Scrimba