Skip to content

Commit

Permalink
Cleanup, fix, linting, python code generator fixed for escaping, file…
Browse files Browse the repository at this point in the history
…s support
  • Loading branch information
Psychokiller1888 committed Nov 23, 2020
1 parent 7a4debb commit f6a5620
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 215 deletions.
14 changes: 7 additions & 7 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
let menuVisible = false;
let exampleVisible =
(localStorage.getItem("show-examples") || "true") == "true";
(localStorage.getItem('show-examples') || 'true') === 'true';
function toggleHamburger() {
menuVisible = !menuVisible;
}
function toggleExample() {
exampleVisible = !exampleVisible;
localStorage.setItem("show-examples", exampleVisible);
localStorage.setItem('show-examples', exampleVisible);
}
</script>

Expand Down Expand Up @@ -111,8 +111,8 @@

<header style="border-top: 6px solid {color !== null ? color : '#6a57d5'};">
<div class="header-left">
<a href="javascript:;" class="hamburger-toggler" on:click={toggleHamburger}>
<i class="fa fa-bars" />
<a href="javascript:" class="hamburger-toggler" on:click={toggleHamburger}>
<i class="fa fa-bars" aria-hidden="true"></i>
</a>

<div class="logo">
Expand All @@ -128,8 +128,8 @@
</a>
</div>
<div class="environment">
<span>Environment:</span>
<select bind:value={envId}>
<label for="env" style="display:inline-block;">Environment:</label>
<select id="env" bind:value={envId}>
{#each config.environments as environment, idx}
<option value={idx}>{environment.name}</option>
{/each}
Expand All @@ -141,7 +141,7 @@
class:inactive={!exampleVisible}
on:click={toggleExample}
title="Toggle request examples">
<i class="fa fa-code" />
<i class="fa fa-code" aria-hidden="true"></i>
</a>
</div>
</header>
Expand Down
3 changes: 1 addition & 2 deletions src/ErrorPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<style>
.error-page {
width: 760px;
margin: 0 auto;
margin-top: 60px;
margin: 60px auto 0;
}
@media only screen and ( max-width: 760px ) {
Expand Down
111 changes: 65 additions & 46 deletions src/components/Content.svelte
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
<script>
import Rows from './content/Rows.svelte';
import applyEnv from '../lib/applyEnv';
import showdown from 'showdown';
import Select from 'svelte-select';
const markdown = new showdown.Converter({
simplifiedAutoLink: true,
openLinksInNewWindow: true,
excludeTrailingPunctuationFromURLs: true,
tables: true
});
import Select from 'svelte-select';
const languages = [
{ value: 'curl', label: 'cURL' },
{ value: 'javascript', label: 'JavaScript/Deno (fetch)' },
{ value: 'python', label: 'Python (requests)' },
{ value: 'node', label: 'Node.js (node-fetch)' },
{ value: 'ruby', label: 'Ruby' },
{ value: 'php', label: 'PHP' },
{ value: 'golang', label: 'Go' }
{
value: 'curl',
label: 'cURL'
},
{
value: 'javascript',
label: 'JavaScript/Deno (fetch)'
},
{
value: 'python',
label: 'Python (requests)'
},
{
value: 'node',
label: 'Node.js (node-fetch)'
},
{
value: 'ruby',
label: 'Ruby'
},
{
value: 'php',
label: 'PHP'
},
{
value: 'golang',
label: 'Go'
}
];
export let env;
Expand All @@ -29,52 +48,52 @@
export let workspace;
export let cookiejars;
$: content = [ ...groups, ...requests ];
$: content = [...groups, ...requests];
$: description = workspace.description && markdown.makeHtml(applyEnv(workspace.description, env));
let selectedValue = languages[0];
$: language = selectedValue.value;
</script>

<section class="content">
<div class="row">
<div class="left">
<h1>{workspace.name}</h1>
{#if description}
<div class="description">{@html description}</div>
{/if}
</div>
<div class="right">
<div class="language-selector">
<Select
items={languages}
bind:selectedValue
isClearable={false}
isSearchable={false}
/>
</div>
<div class="row">
<div class="left">
<h1>{workspace.name}</h1>
{#if description}
<div class="description">{@html description}</div>
{/if}
</div>
<div class="right">
<div class="language-selector">
<Select
items={languages}
bind:selectedValue
isClearable={false}
isSearchable={false}
/>
</div>
</div>
</div>
</div>
<Rows content={content} {env} {language} {cookiejars} />
<Rows content={content} {env} {language} {cookiejars}/>
</section>

<style>
.content {
margin-left: 260px;
overflow-x: hidden;
}
.content {
margin-left: 260px;
overflow-x: hidden;
}
.language-selector {
text-align: center;
}
.language-selector {
text-align: center;
}
.language-selector {
--background: #555;
--color: #fff;
--listBackground: #343434;
--itemHoverBG: #121212;
--itemIsActiveBG: #6a57d5;
--listMaxHeight: auto;
--border: none;
}
.language-selector {
--background: #555;
--color: #fff;
--listBackground: #343434;
--itemHoverBG: #121212;
--itemIsActiveBG: #6a57d5;
--listMaxHeight: auto;
--border: none;
}
</style>
Loading

0 comments on commit f6a5620

Please sign in to comment.