From 615247db23c31b0892c4c00cad9fb1f0551dfa59 Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Thu, 29 Jan 2026 16:59:40 +0100 Subject: [PATCH 1/2] refactor: improve mobile vote item hover behaviour Ensure the hover behaviour is in the voting item is consistent with the hover behavoir used in the rest of the explorer. --- components/Votes/VoteTable/Views/VoteItem.tsx | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/components/Votes/VoteTable/Views/VoteItem.tsx b/components/Votes/VoteTable/Views/VoteItem.tsx index b949b97e..9b4c0772 100644 --- a/components/Votes/VoteTable/Views/VoteItem.tsx +++ b/components/Votes/VoteTable/Views/VoteItem.tsx @@ -106,12 +106,7 @@ function MobileVoteView({ vote, onSelect, formatWeight }: VoteViewProps) { padding: "2px 8px", margin: "-2px -8px", borderRadius: "6px", - transition: "all 0.2s ease", - "&:hover": { - backgroundColor: "$neutral4", - textDecoration: "underline", - textUnderlineOffset: "4px", - }, + cursor: "pointer", "&:focus-visible": { outline: "2px solid $primary11", outlineOffset: "2px", @@ -183,25 +178,18 @@ function MobileVoteView({ vote, onSelect, formatWeight }: VoteViewProps) { backgroundColor: "transparent", padding: "$2", margin: "-$2", - borderRadius: "$1", minHeight: "44px", fontSize: "$1", fontWeight: 600, - transition: "background-color 0.2s ease", - "&:hover": { - backgroundColor: "$neutral3", - }, - "&:focus-visible": { - outline: "2px solid $primary11", - outlineOffset: "2px", - }, }} > - - {isExpanded ? "Hide reason" : "Show reason"} + + + {isExpanded ? "Hide reason" : "Show reason"} + {isExpanded && ( Date: Thu, 29 Jan 2026 17:36:24 +0100 Subject: [PATCH 2/2] refactor: reuse DataTable pagination for mobile vote tabke Reuse the existing arrow-only pagination from DataTable in the mobile voting table to ensure consistent behavior and styling. --- components/Table/Pagination.tsx | 67 +++++++++++++++++++ components/Table/index.tsx | 56 +++------------- .../Votes/VoteTable/Views/MobileVoteTable.tsx | 50 +++----------- components/Votes/VoteTable/Views/VoteItem.tsx | 12 ++-- 4 files changed, 93 insertions(+), 92 deletions(-) create mode 100644 components/Table/Pagination.tsx diff --git a/components/Table/Pagination.tsx b/components/Table/Pagination.tsx new file mode 100644 index 00000000..5a8ee131 --- /dev/null +++ b/components/Table/Pagination.tsx @@ -0,0 +1,67 @@ +import { Box, Flex } from "@livepeer/design-system"; +import { ArrowLeftIcon, ArrowRightIcon } from "@radix-ui/react-icons"; + +type PaginationProps = { + currentPage: number; + totalPages: number; + canPrevious: boolean; + canNext: boolean; + onPrevious: () => void; + onNext: () => void; + css?: object; +}; + +const Pagination = ({ + currentPage, + totalPages, + canPrevious, + canNext, + onPrevious, + onNext, + css, +}: PaginationProps) => { + return ( + + { + if (canPrevious) { + onPrevious(); + } + }} + /> + + Page {currentPage} of{" "} + {totalPages} + + { + if (canNext) { + onNext(); + } + }} + /> + + ); +}; + +export default Pagination; diff --git a/components/Table/index.tsx b/components/Table/index.tsx index db3eddcf..a58a2d7b 100644 --- a/components/Table/index.tsx +++ b/components/Table/index.tsx @@ -8,12 +8,7 @@ import { Thead, Tr, } from "@livepeer/design-system"; -import { - ArrowLeftIcon, - ArrowRightIcon, - ChevronDownIcon, - ChevronUpIcon, -} from "@radix-ui/react-icons"; +import { ChevronDownIcon, ChevronUpIcon } from "@radix-ui/react-icons"; import { ReactNode } from "react"; import { Column, @@ -26,6 +21,8 @@ import { useTable, } from "react-table"; +import Pagination from "./Pagination"; + function DataTable({ heading = null, input = null, @@ -243,45 +240,14 @@ function DataTable({ - - { - if (canPreviousPage) { - previousPage(); - } - }} - /> - - Page {pageIndex + 1} of{" "} - {pageCount} - - { - if (canNextPage) { - nextPage(); - } - }} - /> - + diff --git a/components/Votes/VoteTable/Views/MobileVoteTable.tsx b/components/Votes/VoteTable/Views/MobileVoteTable.tsx index badee3ef..b322c2ba 100644 --- a/components/Votes/VoteTable/Views/MobileVoteTable.tsx +++ b/components/Votes/VoteTable/Views/MobileVoteTable.tsx @@ -1,5 +1,5 @@ -import { Box, Button, Flex, Text } from "@livepeer/design-system"; -import { ArrowLeftIcon, ArrowRightIcon } from "@radix-ui/react-icons"; +import Pagination from "@components/Table/Pagination"; +import { Box, Text } from "@livepeer/design-system"; import React from "react"; import { VoteTableProps } from "./DesktopVoteTable"; @@ -44,44 +44,14 @@ export const MobileVoteCards: React.FC = (props) => { {/* Pagination */} {totalPages > 1 && ( - - - - Page {currentPage} of {totalPages} - - - + 1} + canNext={currentPage < totalPages} + onPrevious={() => onPageChange?.(currentPage - 1)} + onNext={() => onPageChange?.(currentPage + 1)} + /> )} ); diff --git a/components/Votes/VoteTable/Views/VoteItem.tsx b/components/Votes/VoteTable/Views/VoteItem.tsx index 9b4c0772..f94c508e 100644 --- a/components/Votes/VoteTable/Views/VoteItem.tsx +++ b/components/Votes/VoteTable/Views/VoteItem.tsx @@ -183,13 +183,11 @@ function MobileVoteView({ vote, onSelect, formatWeight }: VoteViewProps) { fontWeight: 600, }} > - - - {isExpanded ? "Hide reason" : "Show reason"} - + + {isExpanded ? "Hide reason" : "Show reason"} {isExpanded && (