Skip to content

Commit

Permalink
Adds support for space characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Patty committed Jan 25, 2021
1 parent fd2eb78 commit 6fd1552
Show file tree
Hide file tree
Showing 12 changed files with 3,394 additions and 21 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion demo-site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const App = () => {
<Input
type="text"
value={code}
onChange={e => setCode(e.target.value.replace(/ /g, ""))}
onChange={e => setCode(e.target.value)}
onKeyDown={e => {
if (e.keyCode === 13) generate();
}}
Expand Down
77 changes: 77 additions & 0 deletions docs/demo-site.51f96e0f.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/demo-site.51f96e0f.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Barcode Generator | Tecuity</title><link href="https://fonts.googleapis.com/css?family=Montserrat:300,600|VT323&display=swap" rel="stylesheet"><meta property="og:title" content="Barcode Generator Demo Site"><meta property="og:description" content="See @tecuity/barcode-generator in action."><meta property="og:image" content="https://tecuity.github.io/barcode-generator/social.png"><meta property="og:url" content="https://tecuity.github.io/barcode-generator/index.html"><meta name="twitter:title" content="Barcode Generator Demo Site"><meta name="twitter:description" content="See @tecuity/barcode-generator in action."><meta name="twitter:image" content="https://tecuity.github.io/barcode-generator/social.png"><meta name="twitter:card" content="https://tecuity.github.io/barcode-generator/index.html"><link rel="stylesheet" href="https://tecuity.github.io/barcode-generator/demo-site.e0a32588.css"></head><body> <div id="root"></div> <script type="text/javascript" src="https://tecuity.github.io/barcode-generator/demo-site.e9ff0f45.js"></script> </body></html>
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Barcode Generator | Tecuity</title><link href="https://fonts.googleapis.com/css?family=Montserrat:300,600|VT323&display=swap" rel="stylesheet"><meta property="og:title" content="Barcode Generator Demo Site"><meta property="og:description" content="See @tecuity/barcode-generator in action."><meta property="og:image" content="https://tecuity.github.io/barcode-generator/social.png"><meta property="og:url" content="https://tecuity.github.io/barcode-generator/index.html"><meta name="twitter:title" content="Barcode Generator Demo Site"><meta name="twitter:description" content="See @tecuity/barcode-generator in action."><meta name="twitter:image" content="https://tecuity.github.io/barcode-generator/social.png"><meta name="twitter:card" content="https://tecuity.github.io/barcode-generator/index.html"><link rel="stylesheet" href="https://tecuity.github.io/barcode-generator/demo-site.e0a32588.css"></head><body> <div id="root"></div> <script type="text/javascript" src="https://tecuity.github.io/barcode-generator/demo-site.51f96e0f.js"></script> </body></html>
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"homepage": "https://tecuity.github.io/barcode-generator/",
"scripts": {
"build": "node build.js",
"build": "node process.js && node build.js",
"start-site": "parcel demo-site/index.html --out-dir site-dist",
"build-site": "parcel build demo-site/index.html --out-dir docs --public-url https://tecuity.github.io/barcode-generator/"
},
Expand All @@ -36,6 +36,7 @@
"eslint-plugin-react": "7.x",
"eslint-plugin-react-hooks": "1.x",
"normalize.css": "^8.0.1",
"parcel": "^2.0.0-beta.1",
"parcel-bundler": "^1.12.4",
"react": "^16.12.0",
"react-dom": "^16.12.0",
Expand Down
11 changes: 6 additions & 5 deletions src/process.js → process.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
var fs = require('fs');
const SVG_PATH = './svg';
const SVG_PATH = './src/svg';

let config = {};

(()=>{
fs.readdir(SVG_PATH, (err, files) => {
files.filter(f => f.includes('.svg')).forEach(file => {
const svg = fs.readFileSync(`${SVG_PATH}/${file}`, 'utf8')
const letter = file.split('.')[0];
const filename = file.split('.')[0];
const letter = filename === "SPACE" ? ' ' : filename.slice(0,1)

const viewBox = svg.match(/viewBox="(.*?)"/)[1];
const viewBoxParts = viewBox.split(' ')
config[letter.slice(0,1)] = {
config[letter] = {
filename: file,
letter: letter.slice(0,1),
isLower: letter.length === 2,
letter,
isLower: filename.length === 2,
raw: svg,
viewBox: {
raw: viewBox,
Expand Down
Binary file added src/fre3of9x.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions src/svg/SPACE.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/svgMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,20 @@
},
"innerElements": "<title>S</title><g id=\"Layer_2\" data-name=\"Layer 2\"><g id=\"Layer_1-2\" data-name=\"Layer 1\"><path id=\"S\" d=\"M6.49,172.89H0V0H6.49Zm24,0H13V0H30.46Zm13,0H37V0h6.49Zm24,0H49.94V0H67.41Zm24,0H84.89V0h6.49Z\"/></g></g>"
},
" ": {
"filename": "SPACE.svg",
"letter": " ",
"isLower": false,
"raw": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 82.41 172.93\"><g id=\"Layer_2\" data-name=\"Layer 2\"><g id=\"Layer_1-2\" data-name=\"Layer 1\"><path d=\"M5.85,172.93V0H0V172.93Zm76.56,0V0H76.56V172.93Zm-45,0V0H21.62V172.93Zm33.32,0V0H54.94V172.93Zm-21.61,0V0H43.23V172.93Z\"/></g></g></svg>",
"viewBox": {
"raw": "0 0 82.41 172.93",
"minX": "0",
"miny": "0",
"width": "82.41",
"height": "172.93"
},
"innerElements": "<g id=\"Layer_2\" data-name=\"Layer 2\"><g id=\"Layer_1-2\" data-name=\"Layer 1\"><path d=\"M5.85,172.93V0H0V172.93Zm76.56,0V0H76.56V172.93Zm-45,0V0H21.62V172.93Zm33.32,0V0H54.94V172.93Zm-21.61,0V0H43.23V172.93Z\"/></g></g>"
},
"T": {
"filename": "T.svg",
"letter": "T",
Expand Down
Loading

0 comments on commit 6fd1552

Please sign in to comment.