Skip to content

Commit

Permalink
fix problem with table rows
Browse files Browse the repository at this point in the history
  • Loading branch information
tedovn committed May 23, 2024
1 parent 440db13 commit 019ab87
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-components",
"version": "1.2.8",
"version": "1.2.9",
"private": false,
"sideEffects": [
"*.vue",
Expand Down
10 changes: 7 additions & 3 deletions src/assets/styles/_tables.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
@import 'variables';

.row-btn-show {
@apply static flex transform-none;
}

@media (min-width: 768px) {
.nls-btn-show {
.row-btn-show {
display: none;
transition: 0.2s;
position: absolute;
Expand All @@ -11,7 +15,7 @@
transform: translateY(-50%);
}

.earn-row-actions:hover .nls-btn-show {
.table-row-actions:hover .row-btn-show {
transition: 0.2s;

display: flex;
Expand All @@ -29,7 +33,7 @@
transition: 0.2s opacity;
}

.earn-row-actions:hover > div:last-of-type {
.table-row-actions:hover > div:last-of-type {
opacity: 0;
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/components/atoms/tooltip/Tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ function mouseover(event: MouseEvent) {
const rect = parent.getBoundingClientRect();
const elementRect = element.getBoundingClientRect();
const left = rect.left + window.scrollX - elementRect.width / 2 + rect.width / 2;
let left = rect.left + window.scrollX - elementRect.width / 2 + rect.width / 2;
const top = rect.top + window.scrollY - elementRect.height - 10;
const maxWidth = window.innerWidth;
// Adjust the tooltip's position based on the viewport's width
if (window.innerWidth < 768) {
// Adjust this value as needed
left = rect.left + window.scrollX - elementRect.width / 2;
}
element.style.left = `${left}px`;
element.style.top = `${top}px`;
Expand Down
4 changes: 2 additions & 2 deletions src/components/molecules/table-rows/AssetsTableRow.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
:class="[{ 'earn-row-actions relative': rowButton }]"
:class="[{ 'table-row-actions relative': rowButton }]"
class="flex border-b-[1px] border-border-color py-3"
>
<div
Expand Down Expand Up @@ -62,7 +62,7 @@
</div>
<Button
v-if="rowButton"
class="nls-btn-show mt-6 w-full text-[14px] md:mt-0 md:w-auto"
class="row-btn-show mt-6 w-full text-[14px] md:mt-0 md:w-auto"
severity="secondary"
size="medium"
v-bind="rowButton"
Expand Down
4 changes: 2 additions & 2 deletions src/components/molecules/table-rows/EarningAssetsTableRow.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
:class="[{ 'earn-row-actions relative': rowButton }]"
:class="[{ 'table-row-actions relative': rowButton }]"
class="flex flex-wrap border-b-[1px] border-border-color py-3"
>
<div
Expand Down Expand Up @@ -67,7 +67,7 @@
</div>
<Button
v-if="rowButton"
class="nls-btn-show mt-6 w-full text-[14px] md:mt-0 md:w-auto"
class="row-btn-show mt-6 w-full text-[14px] md:mt-0 md:w-auto"
severity="secondary"
size="medium"
v-bind="rowButton"
Expand Down

0 comments on commit 019ab87

Please sign in to comment.