Skip to content

Commit

Permalink
Refine design.
Browse files Browse the repository at this point in the history
- Make suggestions popover charts instead of pushing the down.
- Align controls to top of expression input if the textarea is resized to be tall.- Tweak interval styles to look nice.
  • Loading branch information
cjcenizal committed May 23, 2017
1 parent 3a6f2b8 commit 9248f15
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 32 deletions.
15 changes: 2 additions & 13 deletions src/core_plugins/timelion/public/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@

/**
* 1. Anchor suggestions beneath input.
* 2. Allow for option of positioning suggestions absolutely.
*/
.timelionSearchInputContainer {
flex: 1 1 auto;
display: flex;
flex-direction: column; /* 1 */
position: relative; /* 2 */
}

.timelion-container {
Expand Down Expand Up @@ -95,19 +97,6 @@
opacity: 0.50;
}

.timelion-interval-custom {
width: 60px;
}

.timelion-interval-presets {
width: 90px;
}

.timelion-interval-presets-compact {
width: 10px;
padding-left: 0;
}

timelion-interval {
display: flex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
suggestions="functionSuggestions.list"
selected-index="functionSuggestions.index"
on-click-suggestion="onClickSuggestion(suggestionIndex)"
should-popover="shouldPopoverSuggestions"
></timelion-expression-suggestions>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ app.directive('timelionExpressionInput', function ($http, $timeout) {
rows: '=',
sheet: '=',
updateChart: '&',
shouldPopoverSuggestions: '@',
},
replace: true,
template: timelionExpressionInputTemplate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div
class="suggestions"
ng-class="{ 'suggestions-isPopover': shouldPopover === 'true' }"
data-suggestions-list
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ app.directive('timelionExpressionSuggestions', () => {
suggestions: '=',
selectedIndex: '=',
onClickSuggestion: '&',
shouldPopover: '=',
},
replace: true,
template,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<input
input-focus
class="kuiTextInput"
class="kuiTextInput timelion-interval-custom"
ng-show="interval === 'other'"
ng-class="{'timelion-interval-custom ': inHeader}"
ng-class="{ 'timelion-interval-custom-compact': interval === 'other' }"
ng-model="otherInterval"
>

<select
class="timelion-interval-presets kuiSelect"
><select
class="kuiSelect timelion-interval-presets"
ng-options="intervalOption for intervalOption in intervalOptions"
ng-class="{'timelion-interval-presets-compact': interval === 'other'}"
ng-class="{ 'timelion-interval-presets-compact': interval === 'other' }"
ng-model="interval"
></select>
3 changes: 2 additions & 1 deletion src/core_plugins/timelion/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
<form
role="form"
ng-submit="search()"
class="kuiFieldGroup kuiVerticalRhythm"
class="kuiFieldGroup kuiFieldGroup--alignTop kuiVerticalRhythm"
>
<div class="kuiFieldGroupSection kuiFieldGroupSection--wide">
<div class="kuiLocalSearch timelionLocalSearch">
<timelion-expression-input
sheet="state.sheet[state.selected]"
rows="1"
update-chart="search()"
should-popover-suggestions="true"
></timelion-expression-input>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/core_plugins/timelion/public/suggestions.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@
margin-bottom: 0px;
}
}

&.suggestions-isPopover {
position: absolute;
top: 100%;
}
}
16 changes: 7 additions & 9 deletions src/core_plugins/timelion/public/vis/timelion_vis_params.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
</div>

<div class="form-group">
<div class="timelion-vis-editor-expression">
<div>
<label>Timelion Expression</label>
</div>

<timelion-expression-input
sheet="vis.params.expression"
rows="9"
></timelion-expression-input>
<div>
<label>Timelion Expression</label>
</div>

<timelion-expression-input
sheet="vis.params.expression"
rows="9"
></timelion-expression-input>
</div>

</div>
6 changes: 6 additions & 0 deletions ui_framework/components/form_layout/_field_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
align-items: center; /* 1 */
}

.kuiFieldGroup--alignTop {
align-items: flex-start;
}

.kuiFieldGroupSection {
line-height: $globalLineHeight;

& + & {
margin-left: 10px;
}
Expand Down
12 changes: 10 additions & 2 deletions ui_framework/dist/ui_framework.css
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,16 @@ body {
align-items: center;
/* 1 */ }

.kuiFieldGroupSection + .kuiFieldGroupSection {
margin-left: 10px; }
.kuiFieldGroup--alignTop {
-webkit-box-align: start;
-webkit-align-items: flex-start;
-ms-flex-align: start;
align-items: flex-start; }

.kuiFieldGroupSection {
line-height: 1.5; }
.kuiFieldGroupSection + .kuiFieldGroupSection {
margin-left: 10px; }

.kuiFieldGroupSection--wide {
-webkit-box-flex: 1;
Expand Down
23 changes: 23 additions & 0 deletions ui_framework/doc_site/src/views/form_layout/field_group.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
</div>
</div>

<br>

<div class="kuiFieldGroup">
<div class="kuiFieldGroupSection">
<input
Expand All @@ -34,6 +36,27 @@
</div>
</div>

<br>

<div class="kuiFieldGroup kuiFieldGroup--alignTop">
<div class="kuiFieldGroupSection">
<textarea
class="kuiTextArea"
placeholder="http://"
type="text"
rows="5"
></textarea>
</div>

<div class="kuiFieldGroupSection">
<button class="kuiButton kuiButton--primary">
Ping
</button>
</div>
</div>

<br>

<div class="kuiFieldGroup">
<div class="kuiFieldGroupSection">
<input
Expand Down

0 comments on commit 9248f15

Please sign in to comment.