Skip to content

This is the commit message #15

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

Open
wants to merge 2 commits into
base: main
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
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"files.autoSave": "afterDelay",
"screencastMode.onlyKeyboardShortcuts": true,
"terminal.integrated.fontSize": 18,
"workbench.activityBar.visible": true,
"workbench.colorTheme": "Visual Studio Dark",
"workbench.fontAliasing": "antialiased",
"workbench.statusBar.visible": true,
Expand Down
2 changes: 1 addition & 1 deletion 01_01b/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</head>
<body>
<div class="container">
<h1 class="page-title">Data-driven image card</h1>
<h1 class="page-title">Image card</h1>
<article class="main-content"></article>
</div>
</body>
Expand Down
12 changes: 12 additions & 0 deletions 01_01b/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const mainContent = document.querySelector(".main-content");
const Card = (data) => {
const imgData = data[0];

const date = new Date(imgData.created_at);

const markup = `
<figure class="image">
<img
Expand All @@ -34,6 +36,16 @@ const Card = (data) => {
Photo by
<span class="image__photog">${imgData.user.name}</span>.
</p>
<p>
Uploaded on:
<time class="image__date" datetime="${imgData.created_at}">
${date.toLocaleString("default", {
year: "numeric",
month: "long",
day: "numeric",
})}
</time>
</p>
<p>
<a href="${imgData.links.self}" class="image__link">
View it on Unsplash.
Expand Down