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

lab solved #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LAB | React Tweets</title>
<link
rel="stylesheet"
href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"
integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p"
crossorigin="anonymous"
/>
</head>
<body>
<div id="root"></div>
Expand Down
5 changes: 4 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ const tweetsArray = [
];

function App() {
// const [{user, timestamp, message}] = tweetsArray
return (
<div className="App">
<Tweet />
<Tweet tweet={tweetsArray[0]} />
<Tweet tweet={tweetsArray[1]} />
<Tweet tweet={tweetsArray[2]} />
</div>
);
}
Expand Down
14 changes: 14 additions & 0 deletions src/components/Actions.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function Actions() {

return(
<div className="actions">
{/* Font Awesome icons */}
<i className="far fa-comment" data-testid="comment-icon"></i>
<i className="fas fa-retweet" data-testid="retweet-icon"></i>
<i className="far fa-heart" data-testid="heart-icon"></i>
<i className="fas fa-share" data-testid="share-icon"></i>
</div>
)
}

export default Actions;
9 changes: 9 additions & 0 deletions src/components/Message.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function Message (props) {
return(
<p className="message">{props.message}

</p>
)
}

export default Message;
8 changes: 8 additions & 0 deletions src/components/ProfileImage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

function ProfileImage(props) {
return(
<img src={props.image} className="profile" alt="profile" />
)
}

export default ProfileImage
7 changes: 7 additions & 0 deletions src/components/Timestamp.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

function Timestamp(props) {

return(<span className="timestamp">{props.time}</span>)
}

export default Timestamp;
39 changes: 14 additions & 25 deletions src/components/Tweet.jsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
function Tweet() {
import ProfileImage from "./ProfileImage";
import User from "./User";
import Timestamp from "./Timestamp"
import Message from "./Message"
import Actions from "./Actions"

function Tweet(props) {
return (
<div className="tweet">
<img
src="https://education-team-2020.s3.eu-west-1.amazonaws.com/web-dev/ih_logo.jpeg"
className="profile"
alt="profile"
/>


<ProfileImage image={props.tweet.user.image}/>

<div className="body">
<div className="top">
<span className="user">
<span className="name">Ironhack</span>
<span className="handle">@ironhack</span>
</span>

<span className="timestamp">Nov 30, 2020</span>
<User name={props.tweet.user.name} handle={props.tweet.user.handle} />
<Timestamp time={props.tweet.timestamp} />
</div>

<p className="message">
On December 7th, we will be hosting a #webinar that will introduce you
to #SQL! Are you ready? 🚀
</p>

<div className="actions">
{/* Font Awesome icons */}
<i className="far fa-comment" data-testid="comment-icon"></i>
<i className="fas fa-retweet" data-testid="retweet-icon"></i>
<i className="far fa-heart" data-testid="heart-icon"></i>
<i className="fas fa-share" data-testid="share-icon"></i>
</div>
<Message message={props.tweet.message} />
<Actions />
</div>

<i className="fas fa-ellipsis-h"></i>
Expand Down
11 changes: 11 additions & 0 deletions src/components/User.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function user (props){

return(
<span className="user">
<span className="name">{props.name}</span>
<span className="handle">{props.handle}</span>
</span>
)
}

export default user;