Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
bryphe committed Jun 26, 2020
2 parents eae5e7a + d9ba249 commit 65de1da
Show file tree
Hide file tree
Showing 18 changed files with 1,305 additions and 804 deletions.
42 changes: 20 additions & 22 deletions src/Components/HoverView.re
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ module Styles = {
open Style;
module Colors = Feature_Theme.Colors;

let outer = (~x, ~y) => [position(`Absolute), left(x), top(y)];
let maxHeight = 200;
let maxWidth = 500;

let inner = (~maybeHeight, ~displayAt) =>
let outer = (~x, ~y, ~maybeHeight, ~displayAt) =>
switch (maybeHeight, displayAt) {
| (Some(height), `Top) => [top(- height)]
| _ => []
| (Some(height), `Top) =>
let height = min(height, maxHeight);
[position(`Absolute), left(x), top(y - height)];
| _ => [position(`Absolute), left(x), top(y)]
};
let maxHeight = 200;
let maxWidth = 500;

let container = (~theme) => [
position(`Relative),
Expand Down Expand Up @@ -130,23 +131,20 @@ let%component make =

| _ => ()
};
<View style={Styles.outer(~x, ~y)}>
<View style={Styles.inner(~maybeHeight=state.maybeHeight, ~displayAt)}>
<View style={Styles.container(~theme)}>
<View
style={Styles.contents(
~theme,
~showScrollbar,
~scrollTop=state.scrollTop,
)}
onMouseWheel=scroll
onDimensionsChanged={({height, _}) =>
dispatch(SetHeight(height))
}>
...children
</View>
<View
style={Styles.outer(~x, ~y, ~maybeHeight=state.maybeHeight, ~displayAt)}>
<View style={Styles.container(~theme)}>
<View
style={Styles.contents(
~theme,
~showScrollbar,
~scrollTop=state.scrollTop,
)}
onMouseWheel=scroll
onDimensionsChanged={({height, _}) => dispatch(SetHeight(height))}>
...children
</View>
{showScrollbar ? <scrollbar /> : React.empty}
</View>
{showScrollbar ? <scrollbar /> : React.empty}
</View>;
};
9 changes: 7 additions & 2 deletions src/Components/Tabs.re
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ let schedulePostRender = f => postRenderQueue := [f, ...postRenderQueue^];
let component = React.Expert.component("Tabs");
let make =
(
~children as render: 'a => element,
~children as render: (~isSelected: bool, ~index: int, 'a) => element,
~items: list('a),
~selectedIndex: option(int),
~style,
Expand Down Expand Up @@ -117,7 +117,12 @@ let make =
ref={r => setOuterRef(_ => Some(r))}
style=outerStyle>
<View onDimensionsChanged=postRender style=innerStyle>
{List.map(render, items) |> React.listToElement}
{List.mapi(
index =>
render(~isSelected=Some(index) == selectedIndex, ~index),
items,
)
|> React.listToElement}
</View>
</View>,
hooks,
Expand Down
59 changes: 59 additions & 0 deletions src/Feature/Layout/Configuration.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
open Oni_Core;
open Config.Schema;

module Codec: {
let showLayoutTabs: Config.Schema.codec([ | `always | `smart | `off]);
let layoutTabPosition: Config.Schema.codec([ | `top | `bottom]);
} = {
let showLayoutTabs =
custom(
~decode=
Json.Decode.(
string
|> map(
fun
| "always" => `always
| "smart" => `smart
| "off" => `off
| _ => `smart,
)
),
~encode=
Json.Encode.(
fun
| `always => string("always")
| `smart => string("smart")
| `off => string("off")
),
);

let layoutTabPosition =
custom(
~decode=
Json.Decode.(
string
|> map(
fun
| "top" => `top
| "bottom" => `bottom
| _ => `bottom,
)
),
~encode=
Json.Encode.(
fun
| `top => string("top")
| `bottom => string("bottom")
),
);
};

let showLayoutTabs =
setting("oni.layout.showLayoutTabs", Codec.showLayoutTabs, ~default=`smart);

let layoutTabPosition =
setting(
"oni.layout.layoutTabPosition",
Codec.layoutTabPosition,
~default=`bottom,
);
95 changes: 0 additions & 95 deletions src/Feature/Layout/EditorGroupView.re

This file was deleted.

Loading

0 comments on commit 65de1da

Please sign in to comment.