Skip to content
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
26 changes: 2 additions & 24 deletions cardStyle.css
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
@import url('https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800&display=swap');

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: 'Nunito Sans';
}

nav {
display: flex;
justify-content: space-between;
padding: 16px 80px;
background-color: white;
box-shadow: 0px 6px 9px rgba(0, 0, 0, 0.08);
}

nav ul {
display: flex;
flex-flow: row;
Expand All @@ -31,7 +24,6 @@ nav ul a {
text-decoration: none;
color: black;
}

.button {
display: flex;
justify-content: center;
Expand All @@ -46,16 +38,6 @@ nav ul a {
color: white;
cursor: pointer;
}

/* .fa-plus-circle {
margin-right: 0.8em;
} */

/* .body-div1, .body-div2 {
margin-left: 150px;
margin-right: 150px;
} */

.body-div1 {
margin-top: 25px;
font-size: 24px;
Expand All @@ -66,14 +48,14 @@ nav ul a {
margin-bottom: 60px;
}


.article-card {
width: 320px;
margin: 30rem 0;
margin: 5%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}

.article-card h1 {
margin-top: 20px;
font-weight: 600;
Expand All @@ -87,7 +69,6 @@ nav ul a {
line-height: 22px;
margin: 15px 0;
}

#image{
margin-top: 30px;
}
Expand All @@ -97,7 +78,6 @@ nav ul a {
/* justify-content: space-between; */
float: left;
}

#popup {
width: 100%;
height: 100%;
Expand All @@ -108,7 +88,6 @@ nav ul a {
background-color: #313131;
overflow: auto;
}

img#close {
position: absolute;
right: -910px;
Expand All @@ -134,7 +113,6 @@ div#popupContact {
top: 17%;
margin-left: -400px;
}

#card {
position: absolute;
display: flex;
Expand Down
15 changes: 8 additions & 7 deletions displayCard.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="cardStyle.css">
<title>Document</title>

<title>JS BLOG</title>
</head>
<body>
<nav>
<img src="/assets/logo.svg" alt="logo" />
<img src="./assets/logo.svg" alt="logo" />
<ul>
<li> <a href="/displayCard.html">My Blogs</a></li>
<li> <a href="/displayCard.html">Login</a></li>
<li> <a href="/displayCard.html">Sign Up</a></li>
<li> <a href="displaycard.html">My Blogs</a></li>
<li> <a href="displaycard.html">Login</a></li>
<li> <a href="displaycard.html">Sign Up</a></li>
</ul>
</nav>
<div class="body-div1">
Expand All @@ -34,7 +35,7 @@
</div>
<div id="popupContact">
<button id="close"> <img id="close" src="./assets/close-button.svg"></button>
<img id="rect" src=./assets/rect.svg>
<img id="rect" src=rect.svg>
<h2>Your Post</h2>
<div id="card" >
<input type="hidden" name="blogId" value="" />
Expand All @@ -44,5 +45,5 @@ <h2>Your Post</h2>
</div>
</div>
</body>
<script src="/script.js"></script>
<script src="script.js"></script>
</html>
39 changes: 38 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
/* Fill your code*/
document.getElementById('addBlog').addEventListener('click', function () {
document.getElementById('popupContact').style.display = "block";
})
class Blog {
constructor(title, detail) {
this.title = title;
this.detail = detail;
}
addTitle() {
var title_card = document.createElement('h1');
title_card.setAttribute("id", "blog-title");
console.log(title_card);
document.getElementById('card-text').appendChild(title_card);
title_card.innerHTML += this.title;

}
addDescription() {
var discription_card = document.createElement('p');
discription_card.setAttribute("id", "blog-description");
console.log(discription_card);
document.getElementById('card-text').appendChild(discription_card);
discription_card.innerHTML += this.detail;
}
}

var post = document.getElementById('post');
post.addEventListener('click', function () {
var title = document.getElementById('title').value;
var detail = document.getElementById('detail').value;
var add_blog = new Blog(title, detail);
add_blog.addTitle();
add_blog.addDescription();
var image = document.createElement('img');
image.src = './assets/javascript.png';
var newchild = document.getElementById('flashcard')
newchild.insertBefore(image, newchild.childNodes[0]);
document.getElementById('popupContact').style.display = "none";
})