Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve layout and UX for mobile devices #117

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 86 additions & 1 deletion css/1140.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ img {
height: auto;
}

.mobile-tabs {
display: none;
}

/* Smaller screens */

Expand All @@ -108,7 +111,7 @@ img {
font-size: 16px;
-webkit-text-size-adjust: none;
}

.row, body, .container {
width: 100%;
min-width: 0;
Expand All @@ -127,4 +130,86 @@ img {
padding-right: 20px;
}

/* Re-arrange layout */
body #ExplainGitZen-Container .playground-container {
display: flex;
flex-direction: column;
margin: 0;
left: 0;
right: 0;
bottom: 0;
}

body #ExplainGitZen-Container .control-box {
width: 100%;
height: 30vh;
bottom: 0;
top: auto;
z-index: 105;
background-color: white;
}

body #ExplainGitZen-Container .control-box input[type="text"] {
width: 100vw;
height: 40px;
box-sizing: border-box;
border-top: 1px solid gray;
}

body #ExplainGitZen-Container .control-box .log {
bottom: 40px;
padding-bottom: 10px;
}

body #ExplainGitZen-Container .svg-container {
position: static;
width: 100%;
height: calc(70vh - 15px);
margin-top: 11px;
border: none;
}

/* Tabbed view for Remote scenarios */
#ExplainGitZen-Container .svg-container.remote-container {
height: 70vh;
min-height: auto;
}

#ExplainGitZen-Container .svg-container.remote-container
#ExplainGitZen-Origin {
height: 90%;
}

#ExplainGitZen-Container .svg-container.remote-container.hidden {
opacity: 0;
pointer-events: none;
}

.mobile-tabs {
display: flex;
position: fixed;
z-index: 105;
width: 100%;
background-color: white;
}

.mobile-tabs.hidden {
display: none;
}

.mobile-tabs span {
display: flex;
justify-content: center;
align-items: center;
width: 50%;
text-align: center;
height: 40px;
font-weight: bold;
cursor: pointer;
}

.tab-origin {
background-color: #eff1ff;
}

}
27 changes: 27 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
gtag('config', 'UA-115441830-1');
</script>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Visualizing Git</title>
<script src="js/vendor/jquery.js"></script>
Expand All @@ -23,6 +24,11 @@
</head>
<body>

<div class="mobile-tabs hidden">
<span class="tab-local" onclick="showLocalRepo()">Local Repository</span>
<span class="tab-origin" onclick="showRemoteRepo()">Origin (Remote)</span>
</div>

<div id="ExplainGitZen-Container" style="display:none">
<div class="playground-container">
<pre id='last-command' style='display: none;'></pre>
Expand All @@ -49,6 +55,26 @@
</marker>
</svg>

<script type="text/javascript">
function initMobileTabs () {
var hasRemote = $('#ExplainGitZen-Origin').length > 0;
if(hasRemote) {
$('.mobile-tabs').removeClass('hidden');
showLocalRepo();
}else {
$('.mobile-tabs').addClass('hidden');
showRemoteRepo();
}
}

function showLocalRepo () {
$('.remote-container').addClass('hidden');
}

function showRemoteRepo () {
$('.remote-container').removeClass('hidden');
}
</script>
<script type="text/javascript">
require(['explaingit', 'demos'], function (explainGit, demos) {
function ready(fn) {
Expand Down Expand Up @@ -99,6 +125,7 @@
document.getElementById('last-command').textContent = ""
clean()
open()
initMobileTabs()
}
}

Expand Down
10 changes: 7 additions & 3 deletions js/controlbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,13 @@ function(_yargs, d3, demos) {
.classed('log', true);

input = cBoxContainer.append('input')
.attr('type', 'text')
.classed('input', true)
.attr('placeholder', 'enter git command');
.attr({
type: 'text',
placeholder: 'enter git command',
autocorrect: 'off',
autocapitalize: 'none'
})
.classed('input', true);

log.on('click', function () {
if (d3.event.target === log.node()) {
Expand Down
2 changes: 1 addition & 1 deletion js/explaingit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ define(['historyview', 'controlbox', 'd3'], function(HistoryView, ControlBox, d3
originView = new HistoryView({
name: name + '-Origin',
width: 300,
height: 400,
height: $(window).height() * 0.3,
commitRadius: args.commitRadius,
remoteName: 'origin',
commitData: args.originData,
Expand Down