Improve alignment, padding/margin issues on UI
1. It vertically centers top script menu (including selectors for view, OS and recommendation levels). Before, it did not utilize the empty space on smaller screens when of the menu items overflowed to a new line. This commit fixes it, also adds margin on top selectors on small screens. 2. It adds vertical margin between slider items on vertical view. It also refactors slider component so that the `v-deep` is no longer used, instead style is set through properties. 3. It ensures symmetrical margin on both sides of the handle in slider during horizontal view. Before, the left margin did not exist and right margin was too wide. This commit balances right and left margin of the arrow. 4. It changes the way margining is done for the card list. It removes internal margin from cards, because when they have them they also add that to the outer card list. This commit solves it in a way that unifies setting gap between cards and setting gap between cards. The styles are controlled on card list instead. This way same margins and paddings is also applied to non-card view (i.e. scripts tree). Before margining was done separately and those views looked diferently. 5. It improves styling of cards. It uses variables instead of hardcoded values and also refactors and renames variables for simpler understanding.
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
<template>
|
||||
<div class="slider">
|
||||
<div class="left" ref="leftElement">
|
||||
<slot name="left"></slot>
|
||||
<div class="slider" v-bind:style="{
|
||||
'--vertical-margin': this.verticalMargin,
|
||||
'--first-min-width': this.firstMinWidth,
|
||||
'--first-initial-width': this.firstInitialWidth,
|
||||
'--second-min-width': this.secondMinWidth,
|
||||
}">
|
||||
<div class="first" ref="firstElement">
|
||||
<slot name="first"></slot>
|
||||
</div>
|
||||
<Handle class="handle" @resized="onResize($event)" />
|
||||
<div class="right">
|
||||
<slot name="right"></slot>
|
||||
<div class="second">
|
||||
<slot name="second"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import { Component, Vue, Prop } from 'vue-property-decorator';
|
||||
import Handle from './Handle.vue';
|
||||
|
||||
@Component({
|
||||
@@ -20,7 +25,12 @@ import Handle from './Handle.vue';
|
||||
},
|
||||
})
|
||||
export default class HorizontalResizeSlider extends Vue {
|
||||
private get left(): HTMLElement { return this.$refs.leftElement as HTMLElement; }
|
||||
@Prop() public verticalMargin: string;
|
||||
@Prop() public firstMinWidth: string;
|
||||
@Prop() public firstInitialWidth: string;
|
||||
@Prop() public secondMinWidth: string;
|
||||
|
||||
private get left(): HTMLElement { return this.$refs.firstElement as HTMLElement; }
|
||||
|
||||
public onResize(displacementX: number): void {
|
||||
const leftWidth = this.left.offsetWidth + displacementX;
|
||||
@@ -35,16 +45,22 @@ export default class HorizontalResizeSlider extends Vue {
|
||||
.slider {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.right {
|
||||
flex: 1;
|
||||
.first {
|
||||
min-width: var(--first-min-width);
|
||||
width: var(--first-initial-width);
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: $vertical-view-breakpoint) {
|
||||
.slider {
|
||||
.second {
|
||||
flex: 1;
|
||||
min-width: var(--second-min-width);
|
||||
}
|
||||
@media screen and (max-width: $vertical-view-breakpoint) {
|
||||
flex-direction: column;
|
||||
.left {
|
||||
.first {
|
||||
width: auto !important;
|
||||
}
|
||||
.second {
|
||||
margin-top: var(--vertical-margin);
|
||||
}
|
||||
.handle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user