Skip to content

Commit

Permalink
fix: height and spacing (#9)
Browse files Browse the repository at this point in the history
* fix: height and spacing
* fix: height of launcher
  • Loading branch information
mariobuikhuizen authored and kecnry committed Aug 15, 2024
1 parent 5930cf6 commit d1b2de0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion jdaviz/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def vue_launch_config(self, event):
config = event.get('config')
helper = _launch_config_with_data(config, self.loaded_data,
filepath=self.filepath, show=False)
if self.height != '100%':
if self.height not in ['100%', '100vh']:
# We're in jupyter mode. Set to default height
default_height = helper.app.state.settings['context']['notebook']['max_height']
helper.app.layout.height = default_height
Expand Down
10 changes: 10 additions & 0 deletions jdaviz/solara.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.solara-content-main {
padding-top: 0 !important;
}
.widget-output {
margin: 0;
}
.v-content.jdaviz__content--not-in-notebook {
height: 100vh;
max-height: 100vh;
}
13 changes: 5 additions & 8 deletions jdaviz/solara.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
from pathlib import Path

import solara
import ipygoldenlayout
import ipysplitpanes
Expand Down Expand Up @@ -28,9 +30,11 @@ def Page():

ipyvue.register_component_from_file('g-viewer-tab', "container.vue", jdaviz.__file__)

solara.Style(Path(__file__).parent / "solara.css")

if not len(data_list):
from jdaviz.core.launcher import Launcher
launcher = Launcher(height='100%', filepath=(data_list[0] if len(data_list) == 1 else ''))
launcher = Launcher(height='100vh', filepath=(data_list[0] if len(data_list) == 1 else ''))
solara.display(launcher.main_with_launcher)
return

Expand All @@ -42,11 +46,4 @@ def Page():
else:
viz.load_data(data, **load_data_kwargs)

viz.app.template.template = viz.app.template.template.replace(
'calc(100% - 48px);', '800px' # '80vh !important;'
)

height = '800px'
viz.app.layout.height = height
viz.app.state.settings['context']['notebook']['max_height'] = height
solara.display(viz.app)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jdaviz = [
"data/*",
"data/*/*",
"*.vue",
"*.css",
"components/*.vue",
"configs/*/*/*/*.vue",
"configs/*/*.yaml",
Expand Down

0 comments on commit d1b2de0

Please sign in to comment.