toasts and more

This commit is contained in:
Gregory Schier 2016-04-09 22:03:18 -07:00
parent 4c93317f45
commit af8ead8eff
14 changed files with 96 additions and 40 deletions

View File

@ -89,9 +89,10 @@ class Sidebar extends Component {
<button onClick={(e) => addRequest(requestGroup.id)}> <button onClick={(e) => addRequest(requestGroup.id)}>
<i className="fa fa-plus-circle"></i> <i className="fa fa-plus-circle"></i>
</button> </button>
<RequestGroupActionsDropdown requestGroup={requestGroup} <RequestGroupActionsDropdown
right={true} requestGroup={requestGroup}
className="tall"/> right={true}
className="tall"/>
</div> </div>
</div> </div>
<ul> <ul>
@ -140,7 +141,12 @@ class Sidebar extends Component {
<h1><WorkspaceDropdown /></h1> <h1><WorkspaceDropdown /></h1>
</header> </header>
<div className="grid--v grid--start grid__cell"> <div className="grid--v grid--start grid__cell">
<div className="stock-height form-control form-control--outlined"> <ul
className="grid--v grid--start grid__cell sidebar__scroll hover-scrollbars sidebar__request-list">
{this.renderRequestGroupRow(null)}
{requestGroups.map(requestGroup => this.renderRequestGroupRow(requestGroup))}
</ul>
<div className="form-control form-control--underlined">
<DebouncingInput <DebouncingInput
type="text" type="text"
placeholder="Filter Requests" placeholder="Filter Requests"
@ -148,11 +154,6 @@ class Sidebar extends Component {
value={activeFilter} value={activeFilter}
onChange={this.onFilterChange.bind(this)}/> onChange={this.onFilterChange.bind(this)}/>
</div> </div>
<ul
className="grid--v grid--start grid__cell sidebar__scroll hover-scrollbars sidebar__request-list">
{this.renderRequestGroupRow(null)}
{requestGroups.map(requestGroup => this.renderRequestGroupRow(requestGroup))}
</ul>
</div> </div>
</aside> </aside>
) )

View File

@ -15,11 +15,6 @@ class RequestGroupActionsDropdown extends Component {
<i className="fa fa-caret-down"></i> <i className="fa fa-caret-down"></i>
</button> </button>
<ul> <ul>
<li>
<button onClick={e => actions.duplicateRequest(requestGroup, requestGroupId)}>
<i className="fa fa-copy"></i> Duplicate
</button>
</li>
<li> <li>
<button onClick={e => actions.showRequestGroupUpdateNamePrompt(requestGroup)}> <button onClick={e => actions.showRequestGroupUpdateNamePrompt(requestGroup)}>
<i className="fa fa-edit"></i> Rename <i className="fa fa-edit"></i> Rename

View File

@ -71,6 +71,14 @@ class Modals extends Component {
return isVisible ? modal : null; return isVisible ? modal : null;
})} })}
</div> </div>
<div ref="toasts">
{/*<div className="toast grid">
<div className="toast__message">Request deleted</div>
<button className="btn toast__action">
Undo
</button>
</div> */}
</div>
</div> </div>
); );
} }

View File

@ -1,6 +1,7 @@
// Global // Global
export const LOCALSTORAGE_DEBOUNCE_MILLIS = 500; export const LOCALSTORAGE_DEBOUNCE_MILLIS = 500;
export const LOCALSTORAGE_KEY = 'insomnia'; export const LOCALSTORAGE_KEY = 'insomnia';
export const DEFAULT_FONT_SIZE = '12px';
// HTTP Methods // HTTP Methods
export const METHOD_GET = 'GET'; export const METHOD_GET = 'GET';

View File

@ -16,6 +16,8 @@ import * as RequestGroupActions from '../actions/requestGroups'
import * as RequestActions from '../actions/requests' import * as RequestActions from '../actions/requests'
import * as ResponseActions from '../actions/responses' import * as ResponseActions from '../actions/responses'
import {DEFAULT_FONT_SIZE} from '../constants/global';
// Don't inject component styles (use our own) // Don't inject component styles (use our own)
Tabs.setUseDefaultStyles(false); Tabs.setUseDefaultStyles(false);
@ -123,13 +125,33 @@ class App extends Component {
) )
} }
componentDidMount () {
document.documentElement.style.fontSize = DEFAULT_FONT_SIZE;
}
_keyDown (e) {
if (e.metaKey) {
if (e.keyCode === 189) { // MINUS
let fontSize = parseFloat(document.documentElement.style.fontSize);
document.documentElement.style.fontSize = `${fontSize - 0.5}px`;
} else if (e.keyCode === 187) { // EQUALS
let fontSize = parseFloat(document.documentElement.style.fontSize);
document.documentElement.style.fontSize = `${fontSize + 0.5}px`;
} else if (e.keyCode === 48) { // ZERO
document.documentElement.style.fontSize = DEFAULT_FONT_SIZE;
} else {
// console.log('CTRL + ' + e.keyCode);
}
}
}
render () { render () {
const {actions, requests, responses, requestGroups, prompt, tabs} = this.props; const {actions, requests, responses, requestGroups, prompt, tabs} = this.props;
const activeRequest = requests.all.find(r => r.id === requests.active); const activeRequest = requests.all.find(r => r.id === requests.active);
const activeResponse = responses[activeRequest && activeRequest.id]; const activeResponse = responses[activeRequest && activeRequest.id];
return ( return (
<div className="grid bg-super-dark tall"> <div className="grid bg-super-dark tall" onKeyDown={this._keyDown.bind(this)}>
<Modals /> <Modals />
<Sidebar <Sidebar
activateRequest={actions.activateRequest} activateRequest={actions.activateRequest}

View File

@ -11,29 +11,20 @@
left: 0; left: 0;
display: none; display: none;
z-index: 100; z-index: 100;
width: 180px; min-width: $dropdown-min-width;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.15); box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.15);
padding-top: 4px;
padding-bottom: 4px;
li { li {
background: $bg-super-light; background: $bg-super-light;
//border: 1px solid $hl;
border-bottom-width: 0;
border-top-width: 0;
&:first-child { &:first-child {
border-top-left-radius: $radius-md; border-top-left-radius: $radius-md;
border-top-right-radius: $radius-md; border-top-right-radius: $radius-md;
padding-top: 2px;
border-top-width: 1px;
} }
&:last-child { &:last-child {
border-bottom-left-radius: $radius-md; border-bottom-left-radius: $radius-md;
border-bottom-right-radius: $radius-md; border-bottom-right-radius: $radius-md;
padding-bottom: 2px;
border-bottom-width: 1px;
} }
& > button { & > button {

View File

@ -2,7 +2,6 @@
.header { .header {
height: $line-height-md; height: $line-height-md;
line-height: $line-height-md;
flex-shrink: 0; flex-shrink: 0;
.header__content { .header__content {

View File

@ -0,0 +1,31 @@
@import '../constants/dimensions';
@import '../constants/colors';
.toast {
position: absolute;
z-index: 100;
bottom: $padding-md;
right: $padding-md;
background: $bg-light;
color: $font-light-bg;
box-shadow: 0 0 1rem rgba(0, 0, 0, 0.2);
.toast__message,
.toast__action {
padding: $padding-sm $padding-md;
height: auto;
}
.toast__message {
border-right: 1px solid $hl-md;
}
.toast__action {
color: $font-light-bg;
&:hover {
color: $font-super-light-bg;
background: rgba(0, 0, 0, 0.05);
}
}
}

View File

@ -7,7 +7,8 @@ $bg-super-dark: #292a26;
$color-brand: #7D70CC; $color-brand: #7D70CC;
/* Font Colors */ /* Font Colors */
$font-light-bg: #555; $font-light-bg: #444;
$font-super-light-bg: #555;
$font-dark-bg: #ddd; $font-dark-bg: #ddd;
$font-super-dark-bg: #c8c8c8; $font-super-dark-bg: #c8c8c8;
$font-primary-bg: #eee; $font-primary-bg: #eee;
@ -84,6 +85,6 @@ $info: #52adc1;
.bg-super-light { .bg-super-light {
background: $bg-super-light; background: $bg-super-light;
&, a, textarea, input, button { &, a, textarea, input, button {
color: $font-light-bg; color: $font-super-light-bg;
} }
} }

View File

@ -20,11 +20,14 @@ $line-height-md: 4rem;
$line-height-sm: $line-height-md * 0.75; $line-height-sm: $line-height-md * 0.75;
/* Sidebar */ /* Sidebar */
$sidebar-width: 20rem; $sidebar-width: 19rem;
/* Borders */ /* Borders */
$radius-sm: 1px; $radius-sm: 0.1rem;
$radius-md: 2px; $radius-md: 0.2rem;
/* Dropdowns */
$dropdown-min-width: 15rem;
/* Modals */ /* Modals */
$modal-width: 50rem; $modal-width: 50rem;

View File

@ -21,3 +21,4 @@
@import 'components/scrollbars'; @import 'components/scrollbars';
@import 'components/dropdown'; @import 'components/dropdown';
@import 'components/modal'; @import 'components/modal';
@import 'components/toast';

View File

@ -3,7 +3,6 @@
html { html {
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
font-size: $font-size;
} }
html, body, #root { html, body, #root {
@ -94,10 +93,6 @@ i.fa {
} }
} }
.stock-height {
height: $line-height-md;
}
.section:not(:last-child) { .section:not(:last-child) {
.section__header { .section__header {

View File

@ -56,6 +56,10 @@
width: 100%; width: 100%;
position: relative; position: relative;
.tag {
padding-left: 0;
}
&.sidebar__item--active { &.sidebar__item--active {
color: $font-dark-bg; color: $font-dark-bg;
@ -90,11 +94,15 @@
border-top: 0; border-top: 0;
} }
ul ul .sidebar__item__row > button { ul .sidebar__item__row > button {
padding-left: $padding-md !important; padding-left: $padding-md !important;
} }
ul ul ul .sidebar__item__row > button { ul ul .sidebar__item__row > button {
padding-left: $padding-md * 2 !important; padding-left: $padding-md * 2 !important;
} }
ul ul ul .sidebar__item__row > button {
padding-left: $padding-md * 3 !important;
}
} }

View File

@ -18,7 +18,7 @@ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav,
} }
body { body {
line-height: 1; line-height: normal;
} }
ol, ul { ol, ul {
@ -44,4 +44,4 @@ q {
table { table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
} }