basic card component
This commit is contained in:
parent
735bf856ec
commit
bf00a968a8
@ -6,11 +6,33 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Lit + TS</title>
|
||||
<link rel="stylesheet" href="./src/index.css" />
|
||||
<script type="module" src="/src/my-element.ts"></script>
|
||||
<script type="module" src="/src/fab-card.ts"></script>
|
||||
</head>
|
||||
<body>
|
||||
<my-element>
|
||||
<h1>Vite + Lit</h1>
|
||||
</my-element>
|
||||
<div class="cards-list">
|
||||
<fab-card
|
||||
cardSetId="ROS154"
|
||||
cardName="Arcane Cussing"
|
||||
cardColor="Blue"
|
||||
cardImageSrc="http://localhost:8000/p/ROS154/w400"
|
||||
cardComment="A comment about the card"
|
||||
></fab-card>
|
||||
<fab-card
|
||||
cardSetId="ROS154"
|
||||
cardName="Arcane Cussing"
|
||||
cardColor="Blue"
|
||||
cardImageSrc="http://localhost:8000/p/ROS154/w400"
|
||||
cardComment="A comment about the card"
|
||||
foiling="R"
|
||||
></fab-card>
|
||||
<fab-card
|
||||
cardSetId="ROS154"
|
||||
cardName="Arcane Cussing"
|
||||
cardColor="Blue"
|
||||
cardImageSrc="http://localhost:8000/p/ROS154/w400"
|
||||
cardComment="A comment about the card"
|
||||
foiling="C"
|
||||
></fab-card>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
1099
fab-ui/package-lock.json
generated
Normal file
1099
fab-ui/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
99
fab-ui/src/fab-card.ts
Normal file
99
fab-ui/src/fab-card.ts
Normal file
@ -0,0 +1,99 @@
|
||||
import { LitElement, css, html } from 'lit'
|
||||
import { customElement, property } from 'lit/decorators.js'
|
||||
|
||||
@customElement('fab-card')
|
||||
export class FabCard extends LitElement {
|
||||
@property({ type: String })
|
||||
cardSetId = '';
|
||||
@property({ type: String })
|
||||
cardName = '';
|
||||
@property({ type: String })
|
||||
cardColor = '';
|
||||
@property({ type: String })
|
||||
cardComment = '';
|
||||
@property({ type: String })
|
||||
foiling = 'S';
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<div class="card ${this.foiling != 'S' ? (this.foiling == 'R' ? 'rainbow-foiling' : 'cold-foiling') : ''}">
|
||||
<div class="card-img">
|
||||
<img class="single-card-img" src="http://localhost:8000/p/${this.cardSetId}/w400" alt="${this.cardName}">
|
||||
</div>
|
||||
<div class="card-details">
|
||||
<span class="printing-id">${this.cardSetId}</span>
|
||||
<span class="card-name">${this.cardName}</span>
|
||||
<span class="card-color color-${this.cardColor}">(${this.cardColor})</span>
|
||||
<span class="card-foiling">${this.foiling == "S" ? '' : this.foiling }</span>
|
||||
<!--<span class="comment">${this.cardComment}</span>-->
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
.card {
|
||||
width: 220px;
|
||||
border-radius: 10px;
|
||||
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
|
||||
}
|
||||
.card-img {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
padding-bottom: 140%;
|
||||
}
|
||||
.card-details {
|
||||
padding: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.card-img img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-radius: 8px;
|
||||
box-shadow: rgba(0,0,0,0.18) 0px 2px 8px;
|
||||
transition: box-shadow 0.2s, z-index 0.2s, opacity 0.2s;
|
||||
}
|
||||
.card-img img.single-card-img {
|
||||
width: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
position: absolute;
|
||||
transform: none;
|
||||
z-index: 2;
|
||||
}
|
||||
.printing-id {
|
||||
font-family: "Geist Mono", monospace;
|
||||
font-weight: bold;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.rainbow-foiling {
|
||||
background: linear-gradient(90deg, #ffb347, #ffcc33, #b4ffb3, #b3d1ff, #e0b3ff, #ffb3d1, #ffb347);
|
||||
background-size: 200% 200%;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
text-shadow: 0 1px 2px rgba(0,0,0,0.08);
|
||||
animation: rainbow-move 3s linear infinite alternate;
|
||||
font-weight: bold;
|
||||
}
|
||||
@keyframes rainbow-move {
|
||||
0% { background-position: 0% 50%; }
|
||||
100% { background-position: 100% 50%; }
|
||||
}
|
||||
.cold-foiling {
|
||||
background: linear-gradient(90deg, #b3e0ff, #e6e6e6, #b3e0ff, #e6e6e6, #b3e0ff);
|
||||
background-size: 200% 200%;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
text-shadow: 0 1px 2px rgba(0,0,0,0.08);
|
||||
animation: cold-move 2.5s linear infinite alternate;
|
||||
font-weight: bold;
|
||||
}
|
||||
@keyframes cold-move {
|
||||
0% { background-position: 0% 50%; }
|
||||
100% { background-position: 100% 50%; }
|
||||
}
|
||||
`;
|
||||
}
|
||||
@ -1,38 +1,14 @@
|
||||
:root {
|
||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #242424;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
font-family: Geist, sans-serif;
|
||||
font-optical-sizing: auto;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color: #213547;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.cards-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
justify-content: center;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user