Skip to content

Commit 8194792

Browse files
committed
Added qr contact
1 parent 4791164 commit 8194792

File tree

4 files changed

+113
-8
lines changed

4 files changed

+113
-8
lines changed

content/posts/2018-03-09--diglossia/index.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ toc: true
1010

1111
Diglossia is the segregation of the use of two language varieties on the basis
1212
of function by members of a speech community. That's a pile of jargon. If you
13-
use one language or dialect in formal siturations, and another in informal ones,
13+
use one language or dialect in formal situations, and another in informal ones,
1414
then you are likely a part of a diglossic speech community.
1515

1616
Previous Linguists have named these informal contexts Low (domestic, local) and
1717
call the formal context High (academic, national, global). I will call them
1818
Formal and Informal.
1919

20-
New York has General American English GAE and African American Vernacular AAVE
21-
(also known as Black American English, or Ebonics) among our many languages
22-
spoken here. AAVE is unique because despite being easily identifyable as dialect
23-
of English, it has a distinctive grammar. Copula deletion and negative concord
24-
are two of its features.
20+
New York, like many states, has General American English (GAE) and African
21+
American Vernacular (AAVE) (also known as Black American English, or Ebonics)
22+
among its many dialects. AAVE is unique because despite being easily
23+
identifiable as dialect of English, it has a distinctive grammar. Copula
24+
deletion and negative concord are two of its features.
2525

26-
In school, they don't teach AAVE. If anything opposite is true. My teachers said
26+
In school, they don't teach AAVE. If anything, the opposite is true. My teachers said
2727
"Repeat after me. Ain't is Not a word" and "people will respect you more if you
2828
speak *proper* English." When I went home, I spoke Creole. On the news, I heard
2929
GAE. In TV shows, GAE. On the internet, GAE...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: "QR Contact"
3+
date: 2022-01-08
4+
tags:
5+
- Projects
6+
---
7+
8+
import QRContact from "./qrcontact"
9+
10+
Store your contact info to a QR code. All in-browser.
11+
12+
<QRContact />
13+
14+
15+
Source code is at <https://github.com/rvente/hexameter>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import React from "react";
2+
import debounceRender from 'react-debounce-render';
3+
import { useForm } from "react-hook-form";
4+
import QRCode from "react-qr-code";
5+
import VCard from 'vcard-creator';
6+
7+
8+
/*
9+
* @author Blake Vente
10+
*/
11+
12+
// styles
13+
const inputField = {
14+
width: "50%",
15+
fontSize: "1rem",
16+
borderRadius: "10px",
17+
color: "var(--theme-ui-colors-text)",
18+
borderColor: "var(--theme-ui-colors-text)",
19+
borderStyle: "solid",
20+
borderWidth: "1px",
21+
backgroundColor: "var(--theme-ui-colors-transparent,transparent)",
22+
display: "block",
23+
margin: "10px",
24+
padding: "10px",
25+
}
26+
27+
const fillContainer = {
28+
backgroundColor: "white",
29+
width: "276px", // 256 + 2 * padding
30+
padding: "10px"
31+
}
32+
33+
34+
function ContactQRCode({ firstName, lastName, phoneNumber, title, website, email, company}) {
35+
36+
// Define a new vCard
37+
const myVCard = new VCard()
38+
39+
// Some variables
40+
41+
myVCard
42+
// Add personal data
43+
.addName(lastName, firstName)
44+
// Add work data
45+
.addCompany(company)
46+
.addJobtitle(title)
47+
.addEmail(email)
48+
.addPhoneNumber(phoneNumber.replace(/\D/g,''), 'PREF')
49+
.addURL(website);
50+
51+
console.log(myVCard.toString());
52+
53+
return (
54+
<div style={fillContainer} >
55+
<QRCode value={myVCard.toString()} />
56+
</div>
57+
)
58+
}
59+
const DbounceContactQRCode = debounceRender(ContactQRCode, 500);
60+
61+
export default function QRContact() {
62+
63+
const formFields = {
64+
firstName: "First Name",
65+
lastName: "Last Name",
66+
phoneNumber: "999-999-9999",
67+
title: "Job Title",
68+
company: "Your Company, Inc",
69+
70+
website: "https://example.com",
71+
};
72+
73+
const { register, watch } = useForm(
74+
{ defaultValues: formFields }
75+
);
76+
77+
return (
78+
<div>
79+
<form >
80+
{/* register your input into the hook by invoking the "register" function */}
81+
{Object.keys(formFields).map( (registerKey, i) => <input key={i} style={inputField} {...register(registerKey)} /> )}
82+
</form>
83+
<DbounceContactQRCode {...watch()} />
84+
</div>
85+
);
86+
}

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@
3636
"p5": "^1.4.0",
3737
"react": "^16.14.0",
3838
"react-adsense": "^0.1.0",
39+
"react-debounce-render": "^8.0.1",
3940
"react-dom": "^16.14.0",
41+
"react-hook-form": "^7.27.0",
4042
"react-katex": "^2.0.2",
4143
"react-p5": "^1.3.25",
42-
"react-p5-wrapper": "^2.4.1"
44+
"react-p5-wrapper": "^2.4.1",
45+
"react-qr-code": "^2.0.3",
46+
"vcard-creator": "^0.4.2"
4347
},
4448
"devDependencies": {
4549
"cross-env": "^5.2.0"

0 commit comments

Comments
 (0)