pull/1357/head
Alex P 2017-04-28 16:30:18 -07:00
parent 1bde8105d2
commit 01f162c3a0
2 changed files with 57 additions and 64 deletions

View File

@ -51,40 +51,37 @@ const Dashboard = ({
)} )}
> >
<div className="template-control-bar"> <div className="template-control-bar">
<div className="page-header__left"> <h1 className="template-control--heading">Template Variables</h1>
<h1 className="template-control--heading">Template Variables</h1> <button
{templates.map(({id, values, tempVar}) => { className="btn btn-primary btn-sm template-control--manage"
const items = values.map(value => ({...value, text: value.value})) onClick={onOpenTemplateManager}
const selectedItem = items.find(item => item.selected) || items[0] >
const selectedText = selectedItem && selectedItem.text <span className="icon cog-thick" />
Manage
</button>
{templates.map(({id, values, tempVar}) => {
const items = values.map(value => ({...value, text: value.value}))
const selectedItem = items.find(item => item.selected) || items[0]
const selectedText = selectedItem && selectedItem.text
// TODO: change Dropdown to a MultiSelectDropdown, `selected` to // TODO: change Dropdown to a MultiSelectDropdown, `selected` to
// the full array, and [item] to all `selected` values when we update // the full array, and [item] to all `selected` values when we update
// this component to support multiple values // this component to support multiple values
return ( return (
<div key={id} className="template-control--dropdown"> <div key={id} className="template-control--dropdown">
<Dropdown <Dropdown
items={items} items={items}
selected={selectedText || 'Loading...'} buttonSize="btn-xs"
onChoose={item => selected={selectedText || 'Loading...'}
onSelectTemplate(id, [item].map(x => omit(x, 'text')))} onChoose={item =>
/> onSelectTemplate(id, [item].map(x => omit(x, 'text')))}
<label className="template-control--label"> />
{tempVar} <label className="template-control--label">
</label> {tempVar}
</div> </label>
) </div>
})} )
</div> })}
<div className="page-header__right">
<button
className="btn btn-primary btn-sm"
onClick={onOpenTemplateManager}
>
<span className="icon cog-thick" />
Manage
</button>
</div>
</div> </div>
{cells.length {cells.length
? <LayoutRenderer ? <LayoutRenderer

View File

@ -5,14 +5,13 @@
template variables template variables
*/ */
$template-control--margin: 4px;
.template-control-bar { .template-control-bar {
height: 50px;
display: flex; display: flex;
justify-content: space-between; flex-wrap: wrap;
align-items: center; align-items: center;
margin-bottom: 4px; margin-bottom: $template-control--margin;
padding: 0 14px;
@extend .cell-shell;
} }
.template-control--heading { .template-control--heading {
font-size: 16px; font-size: 16px;
@ -22,14 +21,16 @@
@include no-user-select(); @include no-user-select();
white-space: nowrap; white-space: nowrap;
} }
.template-control--manage {
margin: $template-control--margin;
}
.template-control--dropdown { .template-control--dropdown {
flex: 0 1 auto; flex: 0 1 auto;
min-width: 160px; min-width: 150px;
display: flex; display: flex;
align-items: center; flex-direction: column;
flex-wrap: nowrap; align-items: stretch;
margin: 0 0 0 8px; margin: $template-control--margin;
.dropdown { .dropdown {
order: 2; order: 2;
@ -38,40 +39,35 @@
} }
.dropdown-toggle { .dropdown-toggle {
border-radius: 0 $radius-small $radius-small 0; border-radius: 0 0 $radius-small $radius-small;
width: 100%; width: 100%;
} font-size: 12px;
.dropdown.open > div.btn.dropdown-toggle { font-family: $code-font;
@include gradient-h($c-comet,$c-pool);
} }
.dropdown-menu { .dropdown-menu {
@include gradient-h($c-amethyst,$c-ocean); @include gradient-h($c-star,$c-pool);
@include custom-scrollbar-round($c-ocean,$c-laser); @include custom-scrollbar-round($c-pool,$c-laser);
> li > a { > li > a {
&, &:active {background-color: transparent !important;} &, &:active {background-color: transparent !important;}
font-size: 12px;
font-family: $code-font;
} }
> li { > li {
&:hover {@include gradient-h($c-star,$c-ocean);} &:hover {@include gradient-h($c-comet,$c-pool);}
} }
} }
} }
.template-control--label { .template-control--label {
@include no-user-select();
order: 1; order: 1;
height: 30px; height: 18px;
padding: 0 9px; padding: 0 8px;
margin: 0; margin: 0;
font-size: 12px; font-size: 11px;
font-family: $code-font; font-family: $code-font;
color: $c-potassium; color: $c-potassium;
line-height: 30px; line-height: 18px;
border-radius: $radius-small 0 0 $radius-small; border-radius: $radius-small $radius-small 0 0;
background-color: $g5-pepper; background-color: $g4-onyx;
// transition:
// background-color 0.25s ease,
// color 0.25s ease;
}
.dropdown.open + .template-control--label {
@include gradient-h($c-star,$c-comet);
color: $g20-white;
} }