Skip to content

Commit

Permalink
remove grid onReady
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Polyakov committed Mar 13, 2024
1 parent 47882ed commit 28b9fbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/components/shared/Widget/Grid/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
:prevent-collision="false"
:vertical-compact="compact"
:use-css-transforms="true"
@layout-ready="onReady"
@breakpoint-changed="onBreakpointChanged"
>
<grid-item v-for="widget in gridLayout" :key="widget.i" v-bind="widget">
Expand Down Expand Up @@ -119,7 +118,7 @@ export default class WidgetsGrid extends Vue {
// `height = h * (rowHeight + margin) - margin` - library calculates grid-item height (px)
// `h = (height + margin) / (rowHeight + margin)`
const calculatedH = Math.ceil((height + this.margin) / (this.rowHeight + this.margin));
const updatedH = Math.max(widget.minH, calculatedH);
const updatedH = Math.max(widget.minH ?? 1, calculatedH);
// mutate local layout
widget.h = updatedH;
// update component layout
Expand Down
13 changes: 7 additions & 6 deletions src/views/Swap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<s-checkbox v-model="compact" label="Compact" />
</div>
<div class="s-flex">
<s-checkbox v-model="form" @change="updateWidget(SwapWidgets.Form, $event)" label="Form" />
<s-checkbox v-model="chart" @change="updateWidget(SwapWidgets.Chart, $event)" label="Chart" />
<s-checkbox
v-model="transactions"
Expand Down Expand Up @@ -71,12 +72,12 @@ enum SwapWidgets {
}
const LayoutsConfigDefault: ResponsiveLayouts<LayoutWidgetConfig> = {
lg: [
{ x: 0, y: 0, w: 6, h: 20, i: SwapWidgets.Form },
{ x: 6, y: 0, w: 10, h: 20, i: SwapWidgets.Chart },
{ x: 16, y: 0, w: 8, h: 24, i: SwapWidgets.Transactions },
{ x: 0, y: 20, w: 6, h: 6, i: SwapWidgets.Distribution },
],
// lg: [
// { x: 0, y: 0, w: 6, h: 20, i: SwapWidgets.Form },
// { x: 6, y: 0, w: 10, h: 20, i: SwapWidgets.Chart },
// { x: 16, y: 0, w: 8, h: 24, i: SwapWidgets.Transactions },
// { x: 0, y: 20, w: 6, h: 6, i: SwapWidgets.Distribution },
// ],
md: [
{ x: 0, y: 0, w: 4, h: 20, i: SwapWidgets.Form },
{ x: 4, y: 0, w: 12, h: 20, i: SwapWidgets.Chart },
Expand Down

0 comments on commit 28b9fbc

Please sign in to comment.