-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abstract QCard logic in self-contained object
- Loading branch information
Showing
10 changed files
with
295 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,17 @@ | |
import AppHeader from '../AppHeader.svelte'; | ||
import Footer from '../Footer.svelte'; | ||
import QRCode from '../QRCode.svelte'; | ||
import QCard from "../plugins/qcard"; | ||
let qCard = new QCard( | ||
"Julia", | ||
"Senior Hacker", | ||
"[email protected]", | ||
"+555", | ||
"https://qcard.link", | ||
"We met at the 2021 FOSS Conference in Amsterdamn! 🍺🍺" | ||
) | ||
let name = "Kim" | ||
let title = "DevOps Engineer" | ||
let comment = "We met at the 2021 FOSS Conference in Amsterdamn! 🍺🍺" | ||
let phone = "+555" | ||
let email = "[email protected]" | ||
let sampleVCard = ""; | ||
let sampleVCardLink = ""; | ||
</script> | ||
<article class="limit-width mx-auto"> | ||
|
||
|
@@ -31,16 +34,7 @@ | |
</div> | ||
|
||
<div class="media card"> | ||
<ContactCard | ||
name = {name} | ||
title = {title} | ||
comment = {comment} | ||
phone = {phone} | ||
email = {email} | ||
|
||
bind:vCardString={sampleVCard} | ||
bind:selfLink={sampleVCardLink} | ||
/> | ||
<ContactCard {qCard} /> | ||
</div> | ||
</div> | ||
|
||
|
@@ -72,30 +66,33 @@ | |
</p> | ||
<p> | ||
The vCard is then encoded into <a target="_blank" href="https://en.wikipedia.org/wiki/Base64" alt="Base64 Wikipedia">Base64</a> | ||
and appended to the URL <code>{sampleVCardLink.substring(0, 40)}...</code> | ||
and appended to the URL <code>{qCard.toUrl().substring(0, 40)}...</code> | ||
</p> | ||
<br /> | ||
|
||
<p> | ||
This URL is subsequently stored in the QR code at the top of a QCard. | ||
</p> | ||
<p> | ||
When the QCard is visited, we simply decode the data and display it! | ||
</p> | ||
<br /> | ||
<p> | ||
Completely <strong>knowledgeless</strong>! | ||
Completely client-side and <strong>knowledgeless</strong>! | ||
</p> | ||
|
||
|
||
</div> | ||
<div class="flex-code media"> | ||
|
||
<pre> | ||
{sampleVCard} | ||
{qCard.toVCardString()} | ||
</pre> | ||
|
||
<img class="icon" src="/icons/arrow-down.svg" alt="Arrow pointing down"/> | ||
|
||
<div class="qrcode mx-auto"> | ||
<QRCode dataToEncode = {sampleVCardLink}/> | ||
<QRCode dataToEncode = {qCard.toUrl()}/> | ||
</div> | ||
</div> | ||
</div> | ||
|
@@ -105,7 +102,7 @@ | |
<div class="flex-container flex-dir-reverse"> | ||
<div class="explaination center"> | ||
<img style="width:50%" class="mx-auto" src="/images/undraw_professional_card.svg" alt="A person showing their personal information card"/> | ||
<h1>You know what to do</h1> | ||
<h1>You know what to do!</h1> | ||
<a href="https://qcard.link/create" class="mx-auto bold button">Create a QCard</a> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<script> | ||
import { fly } from 'svelte/transition'; | ||
import { backOut } from 'svelte/easing'; | ||
import ContactCard from '../ContactCard.svelte'; | ||
import { fromUrl } from '../plugins/qcardFactory'; | ||
import { onMount } from 'svelte'; | ||
let loading = true; | ||
let qCard; | ||
onMount(() => { | ||
qCard = fromUrl(window.location.href.toString()) | ||
if (qCard == undefined) | ||
{ | ||
window.location.replace("/"); | ||
} | ||
loading = false | ||
}) | ||
</script> | ||
|
||
<svelte:head> | ||
{#if !loading} | ||
<title>{qCard.name}'s QCard - QCard.link</title> | ||
{/if} | ||
</svelte:head> | ||
|
||
|
||
{#if !loading} | ||
<article> | ||
<div id="contact-card-container" in:fly="{{ x: -100, duration: 600, easing: backOut }}"> | ||
<ContactCard {qCard} /> | ||
<div class="create-footer-link" in:fly="{{ y: -20, duration: 600, delay:800, easing: backOut}}"> | ||
<a href="https://qcard.link">Create your own <strong>QCard</strong></a> | ||
</div> | ||
</div> | ||
</article> | ||
{/if} | ||
|
||
<style> | ||
#contact-card-container { | ||
margin: 2em auto; | ||
max-width: 500px; | ||
} | ||
@media only screen and (max-width: 600px) { | ||
#contact-card-container { | ||
margin: 0 auto; | ||
max-width: none; | ||
} | ||
} | ||
.create-footer-link { | ||
margin: 0.5em auto; | ||
display:block; | ||
font-weight: 300; | ||
text-align: center; | ||
} | ||
</style> |
Oops, something went wrong.