Skip to content

Commit

Permalink
Add link to Github source
Browse files Browse the repository at this point in the history
Update metadata
  • Loading branch information
rafistrauss committed May 19, 2021
1 parent c85fa30 commit 8207277
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 23 deletions.
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsdoc-type-generator",
"version": "1.0.0-beta",
"version": "1.0.0-gamma",
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",
Expand All @@ -22,6 +22,7 @@
"dependencies": {
"@fontsource/fira-mono": "^4.2.2",
"@lukeed/uuid": "^2.0.0",
"cookie": "^0.4.1"
"cookie": "^0.4.1",
"simple-icons": "^4.24.0"
}
}
4 changes: 3 additions & 1 deletion src/lib/Header/index.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script>
import logo from './svelte-logo.svg';
import github from 'simple-icons/icons/github.js';
import IconLink from '$lib/IconLink/index.svelte';
</script>

<header>
Expand All @@ -12,7 +14,7 @@


<div class="corner">
<!-- TODO put something else here? github link? -->
<IconLink link="https://github.com/rafistrauss/jsdoc-generator" svg={github.svg} label={"Link to source code on Github"} color="#388bfd" />
</div>
</header>

Expand Down
23 changes: 23 additions & 0 deletions src/lib/IconLink/index.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script>
export let svg;
export let link;
export let label = 'none';
export let color = 'orange';
</script>

<style>
.iconLink {
width: 32px;
transition: fill 0.3s ease;
display: inline-flex;
}
.iconLink:hover {
fill: var(--hover-color);
}
</style>

<a href={link} target="_blank" class="iconLink" aria-label={label} style="--hover-color: {color}">
{@html svg}
</a>
File renamed without changes
80 changes: 61 additions & 19 deletions src/routes/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
</script>

<script>
import { version } from '../../package.json';
import ogImageUrl from '$lib/images/jsdoc-gen.jpg';
import { generateJSDocOrError } from '$lib/util';
const pageTitle = `JSDoc Type Generator v${version}`;
const pageUrl = 'https://rafistrauss.github.io/jsdoc-generator/';
const pageDescription =
'Automatically generate JSDoc Types from arbitrary JSON objects; infers the shape of JSON to generate JSDoc Types and lets you copy them easily';
let inputValue = `{
"sampleString": "some string",
"sampleNumber": 1,
Expand All @@ -18,37 +26,72 @@
</script>

<svelte:head>
<title>JSDoc Type Generator</title>
<meta name="description" content="Automatically generate JSDoc Types from arbitrary JSON objects; infers the shape of JSON to generate JSDoc Types and lets you copy them easily">
<meta name="author" content="Rafi Strauss">
<meta property="og:image" content="jsdoc-gen.jpg" />
<title>{pageTitle}</title>
<link rel="canonical" href={pageUrl} />
<meta name="description" content={pageDescription} />
<meta name="author" content="Rafi Strauss" />
<meta property="og:url" content={pageUrl} />
<meta property="og:title" content={pageTitle} />
<meta property="og:image" content={ogImageUrl} />
<meta property="og:image:secure_url" content={ogImageUrl} />
<meta property="og:image:type" content={'image/jpg'} />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="627" />
<meta property="og:type" content="website" />

<meta name="twitter:image:src" content={ogImageUrl} />
<meta name="twitter:image" content={ogImageUrl} />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={pageDescription} />
<meta name="twitter:card" content="summary_large_image" />

<meta name="thumbnail" content={ogImageUrl} />

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebApplication",
"name": "JSDoc Type Generator",
"url": "https://rafistrauss.github.io/jsdoc-generator/",
"description": "Automatically generate JSDoc Types from arbitrary JSON objects; infers the shape of JSON to generate JSDoc Types and lets you copy them easily",
"applicationCategory": "UtilitiesApplication",
"genre": "software",
"about": {
"@type": "Thing",
"description": "jsdoc"
},
"browserRequirements": "Requires JavaScript. Requires HTML5.",
"softwareVersion": "1.0.0",
"operatingSystem": "All"
}
</script>
</svelte:head>

<h1 class="welcome">
JSDoc Type Generator
</h1>
<h1 class="welcome">JSDoc Type Generator</h1>
<h2 style="font-size: larger; text-align: center;">
This tool will generate JSDoc types for valid JSON inserted into the textarea.
</h2>
<section>

<label for="jsonInput">Enter/Paste JSON here:</label>
<textarea bind:value={inputValue} name="jsonInput" id="jsonInput" cols="50" rows="10" />
{#if jsdoc === -1}
<p>Invalid JSON input</p>
{:else if jsdoc === null}

<!-- else content here -->
<!-- else content here -->
{:else}
<div style="position: relative; margin-top: 1em;">
<button on:click={async () => {

await navigator.clipboard.writeText(jsdoc);
copyText = 'Copied';
setTimeout(() => {
copyText = 'Copy';
}, 1500)
}} style="position: absolute; right: 0; top: 0">{copyText}</button>
<button
on:click={async () => {
await navigator.clipboard.writeText(jsdoc);
copyText = 'Copied';
setTimeout(() => {
copyText = 'Copy';
}, 1500);
}}
style="position: absolute; right: 0; top: 0"
>
{copyText}
</button>
<pre style="margin: 0;;">
<code>
{jsdoc}
Expand Down Expand Up @@ -76,5 +119,4 @@
width: 100%;
margin-top: 0;
}
</style>

0 comments on commit 8207277

Please sign in to comment.