Skip to content

Commit

Permalink
Merge pull request #16421 from mrdoob/design-update
Browse files Browse the repository at this point in the history
Design update
  • Loading branch information
mrdoob committed May 14, 2019
2 parents 35bd7a8 + 673d4c9 commit feecd52
Show file tree
Hide file tree
Showing 8 changed files with 402 additions and 167 deletions.
61 changes: 50 additions & 11 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,33 @@
<script src="../build/three.min.js" async defer></script>
</head>
<body>

<div id="panel" class="collapsed">
<div id="panel" class="">

<div id="header">

<h1><a href="http://threejs.org">three.js</a></h1>

<img id="expandButton" src="../files/ic_menu_black_24dp.svg">

<div id="sections">
<span class="selected">docs</span> <a href="../examples/">examples</a>
<span class="selected">docs</span>
<a href="../examples/">examples</a>
</div>

<input type="text" id="filter" autocorrect="off" autocapitalize="off" spellcheck="false">
<img id="expandButton" src="../files/ic_menu_black_24dp.svg">
</div>

<div id="panelScrim"></div>

<div id="contentWrapper">
<input placeholder="Search" type="text" id="filter" autocorrect="off" autocapitalize="off" spellcheck="false" />
<div id="exitSearchButton"></div>

<select id="language">
<option value="en">en</option>
<option value="zh">zh</option>
</select>

<div id="content"></div>
</div>

<div id="content"></div>

</div>

<iframe name="viewer"></iframe>
Expand Down Expand Up @@ -89,6 +92,8 @@ <h1><a href="http://threejs.org">three.js</a></h1>
var panel = document.getElementById( 'panel' );
var content = document.getElementById( 'content' );
var expandButton = document.getElementById( 'expandButton' );
var exitSearchButton = document.getElementById( 'exitSearchButton' );
var panelScrim = document.getElementById( 'panelScrim' );
var filterInput = document.getElementById( 'filter' );
var iframe = document.querySelector( 'iframe' );

Expand All @@ -104,12 +109,40 @@ <h1><a href="http://threejs.org">three.js</a></h1>
expandButton.onclick = function ( event ) {

event.preventDefault();
panel.classList.toggle( 'collapsed' );
panel.classList.toggle( 'open' );

};

panelScrim.onclick = function ( event ) {

event.preventDefault();
panel.classList.toggle( 'open' );

};


// Functionality for search/filter input field
filterInput.onfocus = function ( event ) {

panel.classList.add('searchFocused');

}

filterInput.onblur = function ( event ) {

if(filterInput.value === '') {
panel.classList.remove('searchFocused');
}

}

exitSearchButton.onclick = function( event ) {

filterInput.value = '';
updateFilter();
panel.classList.remove('searchFocused');

}

filterInput.oninput = function ( event ) {

Expand Down Expand Up @@ -139,7 +172,13 @@ <h1><a href="http://threejs.org">three.js</a></h1>
if ( event.button !== 0 || event.ctrlKey || event.altKey || event.metaKey ) return;

window.location.hash = pageURL;
panel.classList.add( 'collapsed' );
panel.classList.remove( 'open' );


content.querySelectorAll('a').forEach((item) => {
item.classList.remove('selected');
});
link.classList.add('selected');

} );

Expand Down
127 changes: 89 additions & 38 deletions docs/page.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
:root {
--color-blue: #049EF4;
--text-color: #444;
--border-style: 1px solid #EEE;
--header-height: 56px;
}

@font-face {
font-family: 'RobotoMono';
src: local('RobotoMono'), url('../files/RobotoMono-Regular.woff2') format('woff2');
font-family: 'Roboto Mono';
src: local('Roboto Mono'), url('../files/RobotoMono-Regular.woff2') format('woff2');
font-weight: normal;
font-style: normal;
}
Expand All @@ -13,72 +20,117 @@
}

body {
margin: 78px auto;
padding: 0px 24px;
max-width: 780px;
color: #555;
padding: 20px 24px 40px 24px;
margin: 0;
color: var(--text-color);
font-family: 'SF-Pro-Text', sans-serif;
font-size: 16px;
line-height: 23px;
line-height: 24px;
tab-size: 4;
overflow: auto;
}

a {
color: #1184CE;
color: var(--color-blue);
cursor: pointer;
text-decoration: underline;
text-decoration: none;
}

h1 {
color: #049EF4;
font-size: 32px;
color: var(--color-blue);
font-size: 2.4em;
font-weight: normal;
line-height: 42px;
line-height: 1.36em;
margin-top: 16px;
margin-bottom: -16px;
text-indent: -2px;
}

h2 {
color: #4B0;

font-size: 22px;
color: var(--color-blue);
font-size: 1.8em;
line-height: 1.32em;
font-weight: normal;
line-height: 31px;
margin-top: 40px;
margin-bottom: 12px;
text-indent: -1px;
}

h3 {
color: #000;
font-size: 16px;
font-size: 1.32em;
line-height: 1.48em;
font-weight: normal;
text-indent: -1px;
margin-top: 24px;
margin-bottom: 12px;
}

margin-top: 40px;
p {
margin-top: 24px;
margin-bottom: 24px;
}
ul, ol {
box-sizing: border-box;
padding-left: 20px;
}
ul li,
ol li {
padding-left: 4px;
margin-bottom: 4px;
}

li ul,
li ol {
margin-top: 4px;
}

p, ul, ol {
margin-top: 0;
body {
max-width: 760px;
margin-left: auto;
margin-right: auto;
}

table,
pre,
code {
margin-left: -24px;
margin-right: -24px;
margin-top: 20px;
margin-bottom: 20px;
max-width: 780px;
}

div {
/* padding-left: 30px; */
margin-bottom: 20px;
}

.desc {
padding-left: 0px;
}

pre, code {
margin-top: 20px;
margin-bottom: 20px;
br {
display: none;
}

table {
border-spacing: 24px 4px;
}
table,
table tr,
table td {
text-align: left;
}

table th {
text-decoration: none;
padding: 2px 0;
}

code {
display: block;
padding: 20px;
padding: 20px 24px;
white-space: pre-wrap;
background-color: #f9f9f9;
overflow: auto;
box-sizing: border-box;
}

iframe {
Expand Down Expand Up @@ -109,15 +161,15 @@ strong {

#button {
position: fixed;
bottom: 16px;
right: 16px;
bottom: 12px;
right: 12px;

padding: 8px;
border-radius: 50%;
margin-bottom: 0px; /* TODO div sets it to 20px */
margin-bottom: 0px;

background-color: #dddddd;
opacity: 0.4;
background-color: #E5E5E5;
opacity: .9;
}

#button:hover {
Expand All @@ -127,6 +179,7 @@ strong {

#button img {
display: block;
width: 20px;
}

a.permalink {
Expand Down Expand Up @@ -157,19 +210,17 @@ sub {
/* mobile */

@media all and ( max-width: 640px ) {

body {
margin: 14px auto;
padding: 0px 14px;
font-size: 14px;
line-height: 22px;
padding: 16px 20px;
}

h1 {
margin-top: 0;
font-size: 26px;
}

h2 {
margin-top: 20px;
font-size: 18px;
line-height: 25px;
}
Expand Down
4 changes: 2 additions & 2 deletions docs/prettify/threejs.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pre .dec, code .dec { color: #22c0c4; } /* decimal */

pre.prettyprint, code.prettyprint {
background-color: #F5F5F5;
font-family: 'RobotoMono', monospace;
font-family: 'Roboto Mono', monospace;
font-size: 14px;
line-height: 21px;
line-height: 24px;
}
Loading

0 comments on commit feecd52

Please sign in to comment.