Button styles (#414)

This commit is contained in:
DC
2016-04-15 19:02:38 -07:00
committed by Feross Aboukhadijeh
parent a497afe5cf
commit 85e49dea6d
3 changed files with 64 additions and 42 deletions

View File

@@ -113,28 +113,8 @@ table {
opacity: 0.3; opacity: 0.3;
} }
/* .float-right {
* BUTTONS float: right;
*/
a,
i {
cursor: default;
-webkit-app-region: no-drag;
}
a:not(.disabled):hover,
i:not(.disabled):hover {
-webkit-filter: brightness(1.3);
}
.btn {
width: 40px;
height: 40px;
border-radius: 20px;
font-size: 22px;
transition: all 0.1s ease-out;
text-align: center;
} }
/* /*
@@ -266,14 +246,18 @@ i:not(.disabled):hover {
width: calc(100% - 20px); width: calc(100% - 20px);
max-width: 600px; max-width: 600px;
box-shadow: 2px 2px 10px 0px rgba(0,0,0,0.4); box-shadow: 2px 2px 10px 0px rgba(0,0,0,0.4);
background-color: white; background-color: #eee;
color: #222; color: #222;
padding: 20px; padding: 20px;
} }
.create-torrent-modal input, .modal label {
font-size: 16px;
font-weight: bold;
}
.open-torrent-address-modal input { .open-torrent-address-modal input {
width: calc(100% - 100px) width: 100%;
} }
.create-torrent-modal .torrent-attribute { .create-torrent-modal .torrent-attribute {
@@ -295,35 +279,71 @@ i:not(.disabled):hover {
white-space: nowrap; white-space: nowrap;
} }
/* /*
* BUTTONS * BUTTONS
* See https://www.google.com/design/spec/components/buttons.html
*/ */
button { a,
i { /* Links and icons */
cursor: default;
-webkit-app-region: no-drag;
}
a:not(.disabled):hover,
i:not(.disabled):hover { /* Show they're clickable without pointer: cursor */
-webkit-filter: brightness(1.3);
}
.button-round { /* Circular icon buttons, used on <i> tags */
width: 40px;
height: 40px;
border-radius: 20px;
font-size: 22px;
transition: all 0.1s ease-out;
text-align: center;
}
button { /* Rectangular text buttons */
background: transparent; background: transparent;
margin-left: 10px; margin-left: 10px;
padding: 0; padding: 0;
border: none; border: none;
border-radius: 3px;
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
cursor: pointer; cursor: pointer;
color: #aaa; color: #aaa;
outline: none;
} }
button.primary { button.button-flat {
color: #0cf; color: #222;
padding: 7px 18px;
} }
button:hover { button.button-flat:hover,
-webkit-filter: brightness(1.1); button.button-flat:focus { /* Material design: focused */
background-color: rgba(153, 153, 153, 0.2);
} }
button:active { button.button-flat:active { /* Material design: pressed */
-webkit-filter: brightness(1.1); background-color: rgba(153, 153, 153, 0.4);
text-shadow: none; }
button.button-raised {
background-color: #2196f3;
color: #eee;
padding: 7px 18px;
}
button.button-raised:hover,
button.button-raised:focus {
background-color: #38a0f5;
}
button.button-raised:active {
background-color: #51abf6;
} }
/* /*
@@ -336,7 +356,7 @@ input {
padding: 6px; padding: 6px;
border: 1px solid #bbb; border: 1px solid #bbb;
border-radius: 3px; border-radius: 3px;
box-shadow: 1px 1px 1px 0px rgba(0,0,0,0.1); outline: none;
} }
/* /*

View File

@@ -9,11 +9,13 @@ var {dispatch} = require('../lib/dispatcher')
function OpenTorrentAddressModal (state) { function OpenTorrentAddressModal (state) {
return hx` return hx`
<div class='open-torrent-address-modal'> <div class='open-torrent-address-modal'>
<p><strong>Enter torrent address or magnet link</strong></p> <p><label>Enter torrent address or magnet link</label></p>
<p> <p>
<input id='add-torrent-url' type='text' onkeypress=${handleKeyPress} /> <input id='add-torrent-url' type='text' onkeypress=${handleKeyPress} />
<button class='primary' onclick=${handleOK}>OK</button> </p>
<button class='cancel' onclick=${handleCancel}>Cancel</button> <p class='float-right'>
<button class='button button-flat' onclick=${handleCancel}>CANCEL</button>
<button class='button button-raised' onclick=${handleOK}>OK</button>
</p> </p>
<script>document.querySelector('#add-torrent-url').focus()</script> <script>document.querySelector('#add-torrent-url').focus()</script>
</div> </div>

View File

@@ -141,7 +141,7 @@ function TorrentList (state) {
var playButton var playButton
if (TorrentPlayer.isPlayableTorrent(torrentSummary)) { if (TorrentPlayer.isPlayableTorrent(torrentSummary)) {
playButton = hx` playButton = hx`
<i.btn.icon.play <i.button-round.icon.play
title=${playTooltip} title=${playTooltip}
class=${playClass} class=${playClass}
onclick=${dispatcher('play', infoHash)}> onclick=${dispatcher('play', infoHash)}>
@@ -153,7 +153,7 @@ function TorrentList (state) {
return hx` return hx`
<div class='buttons'> <div class='buttons'>
${playButton} ${playButton}
<i.btn.icon.download <i.button-round.icon.download
class=${torrentSummary.status} class=${torrentSummary.status}
title=${downloadTooltip} title=${downloadTooltip}
onclick=${dispatcher('toggleTorrent', infoHash)}> onclick=${dispatcher('toggleTorrent', infoHash)}>