UX: attempts to have a better use of available space with sk (#9639)

This commit is contained in:
Joffrey JAFFEUX 2020-05-05 12:59:47 +02:00 committed by GitHub
parent 04e4932307
commit bd0abddf6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 48 additions and 44 deletions

View File

@ -808,7 +808,7 @@ export default Component.extend(
placementStrategy = inModal ? "fixed" : "absolute"; placementStrategy = inModal ? "fixed" : "absolute";
} }
const verticalOffset = this.multiSelect ? 0 : 2; const verticalOffset = this.multiSelect ? 0 : 3;
/* global Popper:true */ /* global Popper:true */
this.popper = Popper.createPopper(anchor, popper, { this.popper = Popper.createPopper(anchor, popper, {
@ -822,6 +822,35 @@ export default Component.extend(
offset: [0, verticalOffset] offset: [0, verticalOffset]
} }
}, },
{
name: "applySmallScreenOffset",
enabled: window.innerWidth <= 450,
phase: "main",
fn({ state }) {
let { x } = state.elements.reference.getBoundingClientRect();
state.modifiersData.popperOffsets.x = -x + 10;
}
},
{
name: "applySmallScreenMaxWidth",
enabled: window.innerWidth <= 450,
phase: "beforeWrite",
fn({ state }) {
state.styles.popper.width = `${window.innerWidth - 20}px`;
}
},
{
name: "sameWidth",
enabled: window.innerWidth > 400,
phase: "beforeWrite",
requires: ["computeStyles"],
fn: ({ state }) => {
state.styles.popper.minWidth = `${state.rects.reference.width}px`;
},
effect: ({ state }) => {
state.elements.popper.style.minWidth = `${state.elements.reference.offsetWidth}px`;
}
},
{ {
name: "positionWrapper", name: "positionWrapper",
phase: "afterWrite", phase: "afterWrite",

View File

@ -39,10 +39,6 @@
} }
} }
.select-kit-body {
min-width: 300px;
}
.select-kit-row { .select-kit-row {
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;

View File

@ -1,6 +1,6 @@
.select-kit { .select-kit {
.category-row { .category-row {
max-width: 320px; max-width: 345px;
.category-status { .category-status {
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -17,8 +17,6 @@
border: 1px solid $primary-low; border: 1px solid $primary-low;
background-clip: padding-box; background-clip: padding-box;
box-shadow: shadow("dropdown"); box-shadow: shadow("dropdown");
max-width: 300px;
width: 300px;
} }
.select-kit-row { .select-kit-row {
@ -89,6 +87,7 @@
font-weight: normal; font-weight: normal;
color: $primary-medium; color: $primary-medium;
white-space: normal; white-space: normal;
min-width: 350px;
} }
} }
} }

View File

@ -4,10 +4,6 @@
background: $secondary; background: $secondary;
border-radius: 0; border-radius: 0;
.select-kit-body {
width: 100%;
}
.select-kit-row { .select-kit-row {
margin: 5px; margin: 5px;
min-height: 1px; min-height: 1px;

View File

@ -3,11 +3,6 @@
&.notifications-button { &.notifications-button {
.select-kit-body { .select-kit-body {
max-width: 400px; max-width: 400px;
width: 400px;
@media screen and (max-width: 767px) {
width: auto;
}
} }
.select-kit-row { .select-kit-row {

View File

@ -24,11 +24,5 @@
.pinned-options { .pinned-options {
display: inline; display: inline;
.select-kit-body {
min-width: unset;
max-width: unset;
width: 550px;
}
} }
} }

View File

@ -1,6 +1,5 @@
.select-kit { .select-kit {
border: none; border: none;
min-width: 220px;
box-sizing: border-box; box-sizing: border-box;
display: inline-block; display: inline-block;
flex-direction: column; flex-direction: column;
@ -22,12 +21,8 @@
.select-kit-body { .select-kit-body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
left: 0;
position: absolute;
top: 0;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
max-width: 450px;
} }
.select-kit-collection { .select-kit-collection {
@ -133,7 +128,6 @@
display: none; display: none;
background: $secondary; background: $secondary;
box-sizing: border-box; box-sizing: border-box;
width: auto;
} }
.select-kit-row { .select-kit-row {

View File

@ -1,11 +1,19 @@
.topic-footer-mobile-dropdown { .select-kit {
.select-kit-row { &.combo-box {
.svg-icon-title { &.topic-footer-mobile-dropdown {
margin-right: 0.5em; .select-kit-row {
} .svg-icon-title {
&.bookmarked { margin-right: 0.5em;
.d-icon { }
color: $tertiary; &.bookmarked {
.d-icon {
color: $tertiary;
}
}
}
.select-kit-collection {
max-height: 100%;
} }
} }
} }

View File

@ -81,9 +81,6 @@
.category-input { .category-input {
margin-bottom: 5px; margin-bottom: 5px;
.category-chooser {
width: 100% !important;
}
} }
.submit-panel { .submit-panel {
@ -206,10 +203,6 @@
} }
} }
} }
.title-and-category .select-kit {
min-width: unset;
}
} }
.title-input, .title-input,