Skip to content

Commit

Permalink
Comleted Lab-6
Browse files Browse the repository at this point in the history
  • Loading branch information
cao00121 committed Oct 19, 2023
1 parent a25012e commit faab368
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
50 changes: 50 additions & 0 deletions lab-6/CSS/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* Import the font used as label */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed&family=Roboto+Slab&display=swap');

body {
margin: 0;
padding: 0;
}

h1 {
font-family: 'Roboto Slab', serif;
display: flex;
justify-content: center;
font-size: 3rem;
flex-wrap: wrap;
}

.emoji-gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
width: 100%;
gap: 20px;
}

.emoji-container {
display: flex;
width: 200px;
height: 200px;
border: 1.6px solid rgb(214, 214, 214);
border-radius: 2px;
justify-content: center;
flex-direction: column;
align-items: center;
}

.emoji-name {
font-size: 0.8rem;
color: black;
font-family: 'Roboto Condensed', sans-serif;
background-color: lightgrey;
max-width: 80%;
line-height: 1rem;
padding: 2px 8px;
text-align: center;
}

.emoji-block {
font-size: 4rem;
display: block;
}
1 change: 1 addition & 0 deletions lab-6/emoji.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions lab-6/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CST8209 - Lab6</title>
<link rel="stylesheet" href="./CSS/style.css">
<script src="emoji.js" defer></script>
<script src="script.js" defer></script>
</head>
<body>
<h1>🖼 Emoji Gallery 🖼</h1>
<div class="emoji-gallery" id="emoji-gallery"></div>
</body>
</html>
18 changes: 18 additions & 0 deletions lab-6/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Get the element by its id
const galleryContent = document.getElementById('emoji-gallery')

// Declare an empty string to contain the emoji string later
let emojiList = ''

// Use For...Of to create the HTML string and add into the emojiList
for (const item of emoji) {
emojiList += `
<div class="emoji-container" title="${item.codes}">
<div class="emoji-block">${item.char}</div>
<div class="emoji-name">${item.name}</div>
</div>
`;
}

// Set all the emoji HTML as the content of emoji gallery
galleryContent.innerHTML = emojiList;

0 comments on commit faab368

Please sign in to comment.