Skip to content

Commit

Permalink
Merge pull request ethereum#562 from ethereum/contractTabTitles
Browse files Browse the repository at this point in the history
Fixing styling (caret on instance, abstract contracts title)
  • Loading branch information
yann300 authored May 30, 2017
2 parents a6f3391 + d77bb33 commit d80462e
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions src/universal-dapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ var css = csjs`
.title extends ${styles.titleBox} {
cursor: pointer;
background-color: ${styles.colors.violet};
}
.title:hover {
opacity: .8;
justify-content: flex-start;
min-width: 400px;
}
.contract .title:before {
margin-right: 30%;
margin-left: 5%;
content: "\\25BE";
}
.contract.hidesub .title:before {
content: "\\25B8"
margin-right: 30%;
margin-left: 5%;
content: "\\25B8";
}
.contract.hidesub {
padding-bottom: 0;
Expand All @@ -49,12 +52,16 @@ var css = csjs`
.contract.hidesub > *:not(.title) {
display: none;
}
.size {
margin-left: 20%;
}
`

var cssInstance = csjs`
.title {
display: flex;
justify-content: space-around;
min-width: 400px;
align-items: center;
margin-bottom: 1em;
padding: .3em;
Expand All @@ -68,16 +75,15 @@ var cssInstance = csjs`
margin-right: 1em;
word-break: break-all;
}
.titleText:hover {
opacity: .8;
}
.instance .title:before {
content: "\\25BE";
margin-right: .5em;
margin-left: .5em;
}
.instance.hidesub .title:before {
content: "\\25B8"
content: "\\25B8";
margin-right: .5em;
margin-left: .5em;
}
.instance.hidesub {
padding-bottom: 0;
Expand All @@ -86,12 +92,10 @@ var cssInstance = csjs`
.instance.hidesub > *:not(.title) {
display: none;
}
.copy extends ${styles.button} {
.copy extends ${styles.button} {
border: 1px dotted ${styles.colors.grey};
border-radius: 5px;
text-align: center;
padding: .3em .3em;
min-width: 30%;
padding: 0 .3em;
font-weight: bold;
}
.copy:hover{
opacity: .7;
Expand Down Expand Up @@ -254,7 +258,7 @@ UniversalDApp.prototype.render = function () {
var $title = $(`<span class="${css.title}"/>`).text(self.contracts[c].name)
$title.click(function (ev) { $(this).closest(`.${css.contract}`).toggleClass(`${css.hidesub}`) })
if (self.contracts[c].bytecode) {
$title.append($('<div class="size"/>').text((self.contracts[c].bytecode.length / 2) + ' bytes'))
$title.append($(`<div class="${css.size}"></div>`).text((self.contracts[c].bytecode.length / 2) + ' bytes'))
}
$contractEl.append($title).append(self.getCreateInterface($contractEl, self.contracts[c]))
}
Expand Down Expand Up @@ -352,16 +356,17 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
var len = address.length
var shortAddress = address.slice(0, 5) + '...' + address.slice(len - 5, len)
var title = yo`
<div class="${cssInstance.title}">
<div class="${cssInstance.titleText}" onclick=${toggleClass}> ${contract.name} at ${shortAddress} (${context}) </div>
<div class="${cssInstance.title}" onclick=${toggleClass}>
<div class="${cssInstance.titleText}"> ${contract.name} at ${shortAddress} (${context}) </div>
<div class="${cssInstance.copy}" onclick=${copyToClipboard}> <i class="fa fa-clipboard" aria-hidden="true"></i> Copy address </div>
</div>
`
function toggleClass () {
$instance.toggleClass(`${cssInstance.hidesub}`)
}

function copyToClipboard () {
function copyToClipboard (event) {
event.stopPropagation();
copy(address)
}

Expand Down

0 comments on commit d80462e

Please sign in to comment.