diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index d9200e046..ed7288660 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -250,6 +250,22 @@ var HelperModule = (function(){ return exit; }); + + const RESIZE_OBSERVER = new ResizeObserver(function(entries) { + entries.forEach((entry) => { + if (entry.target.offsetWidth <= parseInt(entry.target.getAttribute('data-width-breakpoint'))) { + entry.target.classList.add('narrow'); + } else { + entry.target.classList.remove('narrow'); + } + }); + }); + + $(document).on('turbolinks:load', function() { + $('[data-width-breakpoint]').each(function() { + RESIZE_OBSERVER.observe(this); + }); + }); }()); // Check that loaded page, not turbolinks preview diff --git a/app/assets/stylesheets/experiment/canvas.scss b/app/assets/stylesheets/experiment/canvas.scss index 931123e5f..1fa703a3d 100644 --- a/app/assets/stylesheets/experiment/canvas.scss +++ b/app/assets/stylesheets/experiment/canvas.scss @@ -45,6 +45,9 @@ } } +.view-switch-button { + margin-right: .25em; +} .canvas-preview-img, .canvas-preview-rect { diff --git a/app/assets/stylesheets/experiment/show.scss b/app/assets/stylesheets/experiment/show.scss index c481465f2..15888262c 100644 --- a/app/assets/stylesheets/experiment/show.scss +++ b/app/assets/stylesheets/experiment/show.scss @@ -26,6 +26,27 @@ } } +#experimentTable, +#experiment-canvas { + .narrow { + .btn:not(.prevent-shrink) { + padding: 7px; + width: 36px; + } + + .hidden-xs { + display: none; + } + + .left, + .middle, + .right { + display: flex; + flex-direction: inherit; + } + } +} + #experiment-canvas { [data-view-mode="archived"] { display: none; diff --git a/app/assets/stylesheets/experiment/table.scss b/app/assets/stylesheets/experiment/table.scss index 553113116..93a7ff3be 100644 --- a/app/assets/stylesheets/experiment/table.scss +++ b/app/assets/stylesheets/experiment/table.scss @@ -56,6 +56,7 @@ .view-switch-button { outline: 1px solid $color-alto; + margin-right: .25em; } .view-switch, diff --git a/app/assets/stylesheets/label_templates/index.scss b/app/assets/stylesheets/label_templates/index.scss index 47e27a693..2e48b87ee 100644 --- a/app/assets/stylesheets/label_templates/index.scss +++ b/app/assets/stylesheets/label_templates/index.scss @@ -33,7 +33,7 @@ } } - @media (max-width: 1299px) { + @media (max-width: 800px) { .label-toolbar { .btn:not(.prevent-shrink) { diff --git a/app/assets/stylesheets/repository/repository_toolbar.scss b/app/assets/stylesheets/repository/repository_toolbar.scss index f93a6b1b4..77ba98ab6 100644 --- a/app/assets/stylesheets/repository/repository_toolbar.scss +++ b/app/assets/stylesheets/repository/repository_toolbar.scss @@ -160,7 +160,7 @@ } } - @media (max-width: 1624px) { + @media (max-width: 1000px) { .repository-toolbar { .btn:not(.prevent-shrink) { diff --git a/app/assets/stylesheets/shared/content_pane.scss b/app/assets/stylesheets/shared/content_pane.scss index 451a460ff..134a7ba4c 100644 --- a/app/assets/stylesheets/shared/content_pane.scss +++ b/app/assets/stylesheets/shared/content_pane.scss @@ -184,6 +184,24 @@ padding: 1em 1.5rem; width: calc(100% + 3rem); } + + .narrow { + .btn:not(.prevent-shrink) { + padding: 7px; + width: 36px; + } + + .hidden-xs { + display: none; + } + + .left, + .middle, + .right { + display: flex; + flex-direction: inherit; + } + } } &[data-toolbar-visible="false"] { diff --git a/app/views/experiments/_table_toolbar.html.erb b/app/views/experiments/_table_toolbar.html.erb index 384bf0b35..2ecd49546 100644 --- a/app/views/experiments/_table_toolbar.html.erb +++ b/app/views/experiments/_table_toolbar.html.erb @@ -1,4 +1,4 @@ -