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
4 changes: 2 additions & 2 deletions src/donate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type Options = {
title: string;
highLight: string;
position: string;
links: Array<{ url: string; text: string; style: string }>;
links: Array<{ url: string; text: string; style: string; heart: string; }>;
};
class Donate {
private options: Options;
Expand Down Expand Up @@ -56,7 +56,7 @@ class Donate {
this.options.links.forEach((link) => {
const a = document.createElement("a");
a.setAttribute("href", link.url);
a.setAttribute("class", "button");
a.setAttribute("class", link.heart == "yes" ? "button heart" : "button");
a.setAttribute("style", link.style);
a.target = "_blank";
a.innerHTML = link.text;
Expand Down
15 changes: 13 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1>Donate.JS Demo</h1>
</div>
<div class="select">
<label for="position">Position</label>
<select>
<select id="position">
<option value="">Select</option>
<option value="center">Center</option>
<option value="top">Top</option>
Expand All @@ -64,16 +64,26 @@ <h1>Donate.JS Demo</h1>
>
</div>

<div class="select">
<label for="heart">Button Heart</label>
<select id="heart">
<option value="">Select</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>

<button id="show">Show Modal</button>
</div>

<script>
const show = document.getElementById("show");
const dark = document.getElementById("dark");
const position = document.querySelector("select");
const position = document.getElementById("position");
const title = document.getElementById("title");
const highlight = document.getElementById("highlight");
const message = document.getElementById("message");
const heart = document.getElementById("heart");

show.addEventListener("click", () => {
const donate = new Donate({
Expand All @@ -85,6 +95,7 @@ <h1>Donate.JS Demo</h1>
{
text: "Trendyol Bağış Linki",
url: "https://www.trendyol.com",
heart: heart.value,
},
],
message: message.value,
Expand Down
16 changes: 12 additions & 4 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 10px;
overflow-y: auto;
overflow-x: hidden;
}
.header__title h1 {
font-size: var(--large-size);
Expand Down Expand Up @@ -145,6 +143,18 @@
background: var(--primary-color);
transition: all 0.3s ease;
font-size: var(--small-size);
position: relative;
}
.heart::after {
content: "";
background-image: url("../assets/img/heart2.png");
background-repeat: repeat-y;
bottom: -10px;
height: 20px;
position: absolute;
right: 5px;
width: 21px;
z-index: 1;
}
.green {
border: 1px solid #88be40;
Expand Down Expand Up @@ -172,8 +182,6 @@
width: 100%;
padding: 10px;
max-height: 250px;
overflow-y: auto;
overflow-x: hidden;
}
.popup__content {
margin: 10px;
Expand Down