Skip to content

Commit bb41ec9

Browse files
committed
WIP responsive design
1 parent 81ecf34 commit bb41ec9

9 files changed

Lines changed: 152 additions & 25 deletions

File tree

public/css/custom.css

Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ html {
3030
padding-right: 8px;
3131
}
3232

33-
@media screen and (max-width: 760px) {
34-
#navbar {
35-
display: none;
36-
}
37-
}
38-
3933
.nav ul .selected {
4034
font-weight: bold;
4135
color: #0CB863;
@@ -134,7 +128,6 @@ section.login .flash {
134128

135129
section.register {
136130
margin: auto;
137-
width: 600px;
138131
text-align: center;
139132
}
140133
section.register .title {
@@ -345,8 +338,9 @@ section.triplesec {
345338
}
346339

347340
.recaptcha {
348-
width: 50%;
349-
margin: 0 auto 15px auto;
341+
margin: auto;
342+
display: table;
343+
margin-bottom: 10px;
350344
}
351345

352346
/* https://codepen.io/rdallaire/pen/apoyx */
@@ -410,3 +404,105 @@ input:read-only {
410404
background-color: #d1d1d1;
411405
color: #414141;
412406
}
407+
408+
@media screen and (max-width: 900px) {
409+
#navbar {
410+
display: none;
411+
}
412+
413+
section.triplesec {
414+
width: 100%;
415+
height: auto;
416+
background-color: #F4F4F4;
417+
clear: both;
418+
}
419+
420+
section.triplesec div {
421+
margin-bottom: 50px;
422+
}
423+
424+
section.triplesec div p {
425+
text-align: center;
426+
}
427+
428+
.tripleTitle {
429+
text-align: center;
430+
}
431+
432+
.tripleInfo {
433+
font-size: 14pt;
434+
}
435+
436+
section.hero {
437+
margin: auto;
438+
}
439+
440+
section.hero #subtitle {
441+
margin: auto;
442+
width: 100%;
443+
font-size: 16pt;
444+
}
445+
446+
.navLogo {
447+
448+
}
449+
450+
.freeLogo h3 {
451+
margin-top: 15px;
452+
margin-left: 15px;
453+
font-size: 3.6rem;
454+
margin-bottom: 0rem;
455+
}
456+
457+
h3 {
458+
font-size: 2.5rem;
459+
}
460+
461+
#subtitle {
462+
font-size: 12pt !important;
463+
}
464+
465+
.main {
466+
padding: 5px;
467+
}
468+
469+
.ads {
470+
display: none;
471+
}
472+
473+
#subnav {
474+
display: none;
475+
}
476+
477+
section.tryitout {
478+
width: 90% !important;
479+
}
480+
481+
section.tryitout h4 {
482+
font-size: 2.5rem;
483+
margin-bottom: 1rem !important;
484+
}
485+
486+
#aceEditor {
487+
width: 100% !important;
488+
}
489+
490+
#lintButton {
491+
display: none;
492+
}
493+
494+
#preview {
495+
margin-top: -15px !important;
496+
margin-left: 0px !important;
497+
margin-bottom: 15px !important;
498+
float: left !important;
499+
width: 100% !important;
500+
}
501+
502+
#results {
503+
padding: 0px !important;
504+
}
505+
506+
}
507+
508+
.invisible { display: none; }

public/css/demoEditor.css

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#preview {
2-
margin-top: -29px;
2+
margin-top: -40px;
3+
margin-left: 25px;
34
position: relative;
45
float: right;
5-
width: 35%;
6+
width: 45%;
67
height: 250px;
78
}
89

@@ -12,12 +13,16 @@
1213
white-space: -pre-wrap; /* Opera 4-6 */
1314
white-space: -o-pre-wrap; /* Opera 7 */
1415
word-wrap: break-word; /* Internet Explorer 5.5+ */
15-
height: 175px;
16+
height: 250px;
17+
border: solid #CECECE 1px !important;
18+
margin-top: 0px;
19+
width: 100%;
20+
padding: 5px;
1621
}
1722

1823
#aceEditor {
1924
float: left;
20-
width: 60%;
25+
width: 50%;
2126
margin-top: 5px;
2227
height: 250px;
2328
}

public/css/editor.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
float: right;
55
width: 35%;
66
height: 500px;
7+
border: solid #CECECE 1px !important;
78
}
89

910
#results {

src/js/style.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
$(() => {
2+
$(window).resize(checkSize);
3+
checkSize();
4+
5+
function checkSize() {
6+
if (document.body.clientWidth <= 900) {
7+
$('.tripleSection').removeClass("column");
8+
$('.freeLogo').removeClass("invisible");
9+
} else {
10+
$('.tripleSection').addClass("column");
11+
$('.freeLogo').addClass("invisible");
12+
}
13+
}
14+
});

views/pages/index.ejs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ function phoneNum(format) {
3737
</div>
3838
<section class="triplesec">
3939
<div class="main">
40-
<div class="one-third column">
40+
<div class="one-third column tripleSection">
4141
<h4 class="tripleTitle">Simple</h4>
42-
<p class="tripleInfo">If you know Javascript, you know how to code APIs. APIs are written in Vanilla Javascript. No learning a new language and its fancy syntax required!</p>
42+
<p class="tripleInfo">If you know Javascript, you know how to code APIs. APIs are written in <a class='green' href="http://vanilla-js.com/" target="_blank">Vanilla Javascript</a>. No learning a new language and its fancy syntax required! Check out the <a class='green' href="documentation" target="_blank">documentation</a> to learn how to start making your own APIs!</p>
4343
</div>
44-
<div class="one-third column">
44+
<div class="one-third column tripleSection">
4545
<h4 class="tripleTitle">Powerful</h4>
46-
<p class="tripleInfo">You have complete control over the output of your API. Whether you want </p>
46+
<p class="tripleInfo">You have complete control over the output of your API. Whether your API has complicated conditions or takes advantage of a published snippet, </p>
4747
</div>
48-
<div class="one-third column">
49-
<h4 class="tripleTitle">Secure</h4>
50-
<p class="tripleInfo">Only your account has access to the Lists and APIs that you have created. We also have features such as public links for APIs to prevent your API key and references from being leaked by accident.</p>
48+
<div class="one-third column tripleSection">
49+
<h4 class="tripleTitle">Social</h4>
50+
<p class="tripleInfo">Did you create an awesome piece of code that you think would be helpful for others to use in their APIs? We have snippets! Think of it like NPM modules for APIs.</p>
5151
</div>
5252
</div>
5353
</section>

views/pages/pricing.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
<% include ../snippets/ads %>
7777
</div>
7878
<div class="disclaimers">
79-
<p><br><b><span style="color: orange">Beta users</span></b>: These are the current prices and perks. If you purchase a subscription during the beta period, it'll carry over when RandomAPI releases with the same monthly charge. Beta prices will most likely increase and perk values will <b>definitely</b> increase in the final version.</p>
79+
<p><br><b><span style="color: orange">Beta users</span></b>: These are the current prices and perks. If you purchase a subscription during the beta period, it'll carry over with the <b>same monthly charge</b> when RandomAPI. Beta prices will most likely increase and perk values will <b>definitely</b> increase in the final version.</p>
8080
<hr>
8181
Here be techno jargon<br>
8282
<sup>1</sup>: <span id='disclaimer'>API requests are queued into the generator with the least number of tasks. If there are many users of a tier currently using a generator, it may take a longer time for your results to be generated. Example: 100 tasks spread out over 5 generators gives each generator a load of 20 tasks while 100 tasks all in 1 generator would be significantly slower to receive results for since only 1 generator is doing all of the work. <b>tl;dr</b>: bigger numbers are better.</span><br><br>
83-
<sup>2</sup>: <span id='disclaimer'>If your API uses lists, their contents are cached in memory in order to speed up access times. 60/120/5 means lists have 60 seconds TTL in local cache, 120 seconds TTL in redis cache, and the Generator has 5 MB of local cache. When you make your intial API request, it has to read in all of the list data into memory from disk. This is a timely process, so caching solves this problem by making your list data available in memory until the list hasn't been accessed for X seconds. At that point, your list will be removed from the local cache and any request after that will either have to check the redis cache, or worst case, reread the data from disk again. <b>tl;dr</b>: bigger numbers are better.</span>
83+
<sup>2</sup>: <span id='disclaimer'>If your API uses Lists/Snippets, their contents are cached in memory in order to speed up access times. 60/120/5 means 60 seconds TTL in local cache, 120 seconds TTL in redis cache, and the Generator has 5 MB of local cache. When you make your intial API request, it has to read in all of the List/Snippet data into memory from disk. This is a timely process, so caching solves this problem by making your list data available in memory until the list hasn't been accessed for X seconds. At that point, your list/snippet will be removed from the local cache and any request after that will either have to check the redis cache, or worst case, reread the data from disk again. <b>tl;dr</b>: bigger numbers are better.</span>
8484
</div>
8585
</div>
8686
<% include ../snippets/footer %>

views/pages/upgrade.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@
102102
<% include ../snippets/ads %>
103103
</div>
104104
<div class="disclaimers">
105-
<p><br><b><span style="color: orange">Beta users</span></b>: These are the current prices and perks. If you purchase a subscription during the beta period, it'll carry over when RandomAPI releases with the same monthly charge. Beta prices will most likely increase and perk values will <b>definitely</b> increase in the final version.</p>
105+
<p><br><b><span style="color: orange">Beta users</span></b>: These are the current prices and perks. If you purchase a subscription during the beta period, it'll carry over with the <b>same monthly charge</b> when RandomAPI. Beta prices will most likely increase and perk values will <b>definitely</b> increase in the final version.</p>
106106
<hr>
107107
Here be techno jargon<br>
108108
<sup>1</sup>: <span id='disclaimer'>API requests are queued into the generator with the least number of tasks. If there are many users of a tier currently using a generator, it may take a longer time for your results to be generated. Example: 100 tasks spread out over 5 generators gives each generator a load of 20 tasks while 100 tasks all in 1 generator would be significantly slower to receive results for since only 1 generator is doing all of the work. <b>tl;dr</b>: bigger numbers are better.</span><br><br>
109-
<sup>2</sup>: <span id='disclaimer'>If your API uses lists, their contents are cached in memory in order to speed up access times. 60/120/5 means lists have 60 seconds TTL in local cache, 120 seconds TTL in redis cache, and the Generator has 5 MB of local cache. When you make your intial API request, it has to read in all of the list data into memory from disk. This is a timely process, so caching solves this problem by making your list data available in memory until the list hasn't been accessed for X seconds. At that point, your list will be removed from the local cache and any request after that will either have to check the redis cache, or worst case, reread the data from disk again. <b>tl;dr</b>: bigger numbers are better.</span>
109+
<sup>2</sup>: <span id='disclaimer'>If your API uses Lists/Snippets, their contents are cached in memory in order to speed up access times. 60/120/5 means 60 seconds TTL in local cache, 120 seconds TTL in redis cache, and the Generator has 5 MB of local cache. When you make your intial API request, it has to read in all of the List/Snippet data into memory from disk. This is a timely process, so caching solves this problem by making your list data available in memory until the list hasn't been accessed for X seconds. At that point, your list/snippet will be removed from the local cache and any request after that will either have to check the redis cache, or worst case, reread the data from disk again. <b>tl;dr</b>: bigger numbers are better.</span>
110110
</div>
111111
</div>
112112
<% include ../snippets/footer %>

views/snippets/header.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@
1919
<script src="js/jquery.js"></script>
2020
<script src="js/noty/packaged/jquery.noty.packaged.min.js"></script>
2121
<script src="js/general.js"></script>
22+
<script src="js/style.js"></script>
2223
<message hidden><%=messages%></message>

views/snippets/navbar.ejs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ switch(path) {
1313
case '/pricing':
1414
selected['pricing'] = style;
1515
break;
16+
case '/search':
17+
selected['search'] = style;
18+
break;
1619
case '/documentation':
1720
selected['documentation'] = style;
1821
break;
@@ -28,16 +31,22 @@ switch(path) {
2831
selected['home'] = style;
2932
}
3033
34+
if (selected['search'] && session.loggedin) {
35+
delete selected['search'];
36+
selected['home'] = style;
37+
}
38+
3139
let upgrade;
3240
if (session.user !== undefined && session.user.tierName === 'Free') {
3341
upgrade = "upgrade";
3442
} else {
3543
upgrade = "settings/subscription";
3644
}
3745
%>
46+
<a href="" class="freeLogo invisible"><h3>RandomAPI</h3></a>
3847

3948
<div id="navbar" class="scroll">
40-
<a href=""><h3>RandomAPI</h3></a>
49+
<a href="" class="navLogo"><h3>RandomAPI</h3></a>
4150
<div class="nav">
4251
<ul>
4352
<% if (session.loggedin === true) { %>
@@ -48,6 +57,7 @@ if (session.user !== undefined && session.user.tierName === 'Free') {
4857
<a href="logout"><li>Logout</li></a>
4958
<% } else { %>
5059
<a href=""><li <%- selected['home'] %>>Home</li></a>
60+
<a href="search"><li <%- selected['search'] %>>Search</li></a>
5161
<a href="pricing"><li <%- selected['pricing'] %>>Pricing</li></a>
5262
<a href="documentation"><li <%- selected['documentation'] %>>Documentation</li></a>
5363
<a href="login"><li <%- selected['login'] %>>Login</li></a>

0 commit comments

Comments
 (0)