add icons functionality
This commit is contained in:
32
assets/css/icon.css
Normal file
32
assets/css/icon.css
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
main {
|
||||||
|
display: grid;
|
||||||
|
|
||||||
|
grid-template-columns: repeat( auto-fit, minmax(256px, 1fr) );
|
||||||
|
overflow-x: hidden;
|
||||||
|
gap: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @media screen and (min-width: ){
|
||||||
|
|
||||||
|
} */
|
||||||
|
|
||||||
|
Icon {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
padding: 32px;
|
||||||
|
text-align: end;
|
||||||
|
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
outline: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
Icon:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
Icon img {
|
||||||
|
width: 8rem;
|
||||||
|
height: 8rem;
|
||||||
|
}
|
||||||
BIN
assets/images/cashapp.png
Normal file
BIN
assets/images/cashapp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
BIN
assets/images/discord.ico
Normal file
BIN
assets/images/discord.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 279 KiB |
BIN
assets/images/tiktok.jpg
Normal file
BIN
assets/images/tiktok.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
BIN
assets/images/tiktok.png
Normal file
BIN
assets/images/tiktok.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 298 KiB |
35
assets/js/icon.js
Normal file
35
assets/js/icon.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
const main = document.querySelector("main");
|
||||||
|
|
||||||
|
const icons = main.querySelectorAll("Icon");
|
||||||
|
|
||||||
|
icons.forEach((icon) => {
|
||||||
|
let iconImage = icon.getAttribute("image");
|
||||||
|
let link = icon.getAttribute("href");
|
||||||
|
let title = icon.getAttribute("title");
|
||||||
|
|
||||||
|
console.log(iconImage, link, title);
|
||||||
|
|
||||||
|
if (iconImage) {
|
||||||
|
let imageElement = document.createElement("img");
|
||||||
|
|
||||||
|
imageElement.src = iconImage;
|
||||||
|
imageElement.height = 64;
|
||||||
|
imageElement.width = 64;
|
||||||
|
|
||||||
|
icon.appendChild(imageElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (link) {
|
||||||
|
icon.addEventListener('click', (e) => {
|
||||||
|
window.open(link, "_blank");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (title) {
|
||||||
|
let titleElement = document.createElement("span");
|
||||||
|
|
||||||
|
titleElement.textContent = title;
|
||||||
|
icon.appendChild(titleElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
12
links.html
12
links.html
@@ -5,12 +5,20 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Links are pretty cool</title>
|
<title>Links are pretty cool</title>
|
||||||
<link rel="stylesheet" href="assets/css/global.css">
|
<link rel="stylesheet" href="assets/css/global.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/icon.css">
|
||||||
|
|
||||||
<script src="assets/js/global.js" defer></script>
|
<script src="assets/js/global.js" defer></script>
|
||||||
|
<script src="assets/js/icon.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
<Icon href="https://lunarware.tech" image="/favicon.ico" title="Website"></Icon>
|
||||||
|
<Icon href="https://git.lunarware.tech/lucielle" image="https://git.lunarware.tech/assets/img/favicon.png" title="Gitea"></Icon>
|
||||||
|
<Icon href="#" image="assets/images/discord.ico" title="Discord"></Icon>
|
||||||
|
<Icon href="https://www.tiktok.com/@lucielle.0x22" image="assets/images/tiktok.png" title="TikTok"></Icon>
|
||||||
|
<Icon href="https://cash.app/$LuciEll00" image="assets/images/cashapp.png" title="Cashapp"></Icon>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,16 +1,21 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Projects 'n' stuff</title>
|
<title>Projects 'n' stuff</title>
|
||||||
<link rel="stylesheet" href="assets/css/global.css">
|
<link rel="stylesheet" href="assets/css/global.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/icon.css">
|
||||||
|
|
||||||
<script src="assets/js/global.js" defer></script>
|
<script src="assets/js/global.js" defer></script>
|
||||||
|
<script src="assets/js/icon.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
<Icon href="https://git.lunarware.tech/lucielle/website" image="/favicon.ico" title="Website"></Icon>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user