new project save the previous
Browse files- components/pair-card.js +63 -0
- index.html +18 -25
components/pair-card.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class PairCard extends HTMLElement {
|
| 2 |
+
constructor() {
|
| 3 |
+
super();
|
| 4 |
+
this.attachShadow({ mode: 'open' });
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
connectedCallback() {
|
| 8 |
+
const pair = this.getAttribute('pair') || 'BTC/USDT';
|
| 9 |
+
const image = this.getAttribute('image') || 'http://static.photos/finance/640x360/1';
|
| 10 |
+
const description = this.getAttribute('description') || 'Cryptocurrency trading pair';
|
| 11 |
+
|
| 12 |
+
this.shadowRoot.innerHTML = `
|
| 13 |
+
<style>
|
| 14 |
+
:host {
|
| 15 |
+
display: block;
|
| 16 |
+
border-radius: 0.75rem;
|
| 17 |
+
overflow: hidden;
|
| 18 |
+
transition: all 0.3s ease;
|
| 19 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
| 20 |
+
}
|
| 21 |
+
:host(:hover) {
|
| 22 |
+
transform: translateY(-4px);
|
| 23 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 24 |
+
}
|
| 25 |
+
a {
|
| 26 |
+
display: block;
|
| 27 |
+
text-decoration: none;
|
| 28 |
+
color: inherit;
|
| 29 |
+
}
|
| 30 |
+
.image-container {
|
| 31 |
+
height: 12rem;
|
| 32 |
+
background-size: cover;
|
| 33 |
+
background-position: center;
|
| 34 |
+
background-image: url('${image}');
|
| 35 |
+
}
|
| 36 |
+
.content {
|
| 37 |
+
padding: 1.5rem;
|
| 38 |
+
background: white;
|
| 39 |
+
}
|
| 40 |
+
h3 {
|
| 41 |
+
margin: 0 0 0.5rem 0;
|
| 42 |
+
font-size: 1.25rem;
|
| 43 |
+
font-weight: 600;
|
| 44 |
+
color: #111827;
|
| 45 |
+
}
|
| 46 |
+
p {
|
| 47 |
+
margin: 0;
|
| 48 |
+
color: #6b7280;
|
| 49 |
+
font-size: 0.875rem;
|
| 50 |
+
}
|
| 51 |
+
</style>
|
| 52 |
+
<a href="pair-details.html?pair=${pair}">
|
| 53 |
+
<div class="image-container"></div>
|
| 54 |
+
<div class="content">
|
| 55 |
+
<h3>${pair}</h3>
|
| 56 |
+
<p>${description}</p>
|
| 57 |
+
</div>
|
| 58 |
+
</a>
|
| 59 |
+
`;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
customElements.define('pair-card', PairCard);
|
index.html
CHANGED
|
@@ -24,37 +24,30 @@
|
|
| 24 |
<h1 class="text-5xl font-bold text-gray-800 mb-4">CryptoPilot Pro</h1>
|
| 25 |
<p class="text-xl text-gray-600 max-w-2xl mx-auto">Advanced cryptocurrency trading platform</p>
|
| 26 |
</div>
|
| 27 |
-
|
| 28 |
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
| 29 |
-
<
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
<div class="p-6">
|
| 46 |
-
<h3 class="text-xl font-semibold text-gray-800">SOL/USDT</h3>
|
| 47 |
-
<p class="text-gray-600 mt-2">Solana to Tether pair trading</p>
|
| 48 |
-
</div>
|
| 49 |
-
</a>
|
| 50 |
-
</div>
|
| 51 |
</main>
|
| 52 |
-
|
| 53 |
<custom-footer></custom-footer>
|
| 54 |
|
| 55 |
<script src="components/navbar.js"></script>
|
| 56 |
<script src="components/footer.js"></script>
|
|
|
|
| 57 |
<script src="script.js"></script>
|
| 58 |
-
|
| 59 |
</body>
|
| 60 |
</html>
|
|
|
|
| 24 |
<h1 class="text-5xl font-bold text-gray-800 mb-4">CryptoPilot Pro</h1>
|
| 25 |
<p class="text-xl text-gray-600 max-w-2xl mx-auto">Advanced cryptocurrency trading platform</p>
|
| 26 |
</div>
|
|
|
|
| 27 |
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
| 28 |
+
<pair-card
|
| 29 |
+
pair="BTC/USDT"
|
| 30 |
+
image="http://static.photos/finance/640x360/1"
|
| 31 |
+
description="Bitcoin to Tether pair trading">
|
| 32 |
+
</pair-card>
|
| 33 |
+
<pair-card
|
| 34 |
+
pair="ETH/USDT"
|
| 35 |
+
image="http://static.photos/finance/640x360/2"
|
| 36 |
+
description="Ethereum to Tether pair trading">
|
| 37 |
+
</pair-card>
|
| 38 |
+
<pair-card
|
| 39 |
+
pair="SOL/USDT"
|
| 40 |
+
image="http://static.photos/finance/640x360/3"
|
| 41 |
+
description="Solana to Tether pair trading">
|
| 42 |
+
</pair-card>
|
| 43 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
</main>
|
|
|
|
| 45 |
<custom-footer></custom-footer>
|
| 46 |
|
| 47 |
<script src="components/navbar.js"></script>
|
| 48 |
<script src="components/footer.js"></script>
|
| 49 |
+
<script src="components/pair-card.js"></script>
|
| 50 |
<script src="script.js"></script>
|
| 51 |
+
<script>feather.replace();</script>
|
| 52 |
</body>
|
| 53 |
</html>
|