Skip to content

Commit

Permalink
Revert "Merge pull request pancakeswap#217 from kogecoin/190-enable-a…
Browse files Browse the repository at this point in the history
…py-sorting-in-mobile"

This reverts commit f8ad08b, reversing
changes made to daf8733.
  • Loading branch information
loganbek committed Oct 2, 2021
1 parent aa076a6 commit c3042ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 51 deletions.
1 change: 0 additions & 1 deletion src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const DropDownHeader = styled.div<{ isActive?: boolean }>`

const DropDownListContainer = styled.div`
min-width: 136px;
width: 100%;
height: 0;
position: absolute;
top: 45px;
Expand Down
52 changes: 2 additions & 50 deletions src/views/Farms/components/FarmTable/FarmTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Button, ChevronUpIcon, ColumnType, Flex, Text, useTable } from 'components/Pancake';
import { Collapsible, Sort } from 'components/Pancake/Svg';
import Select from 'components/Select/Select';
import { useTranslation } from 'contexts/Localization';
import _ from 'lodash';
import React, { useRef, useState } from 'react';
Expand All @@ -18,26 +17,6 @@ export interface ITableProps {
handleCurrent?: (count: number) => void
}

const LabelWrapper = React.memo(styled.div`
position: relative;
width: 168px;
> ${Text} {
font-size: 10px;
position: absolute;
top: -8px;
z-index: 1;
background: ${({ theme }) => theme.colors.background};
display: inline-block;
left: 10px;
padding: 2px 6px;
}
@media screen and (max-width: 576px) {
width: 100%;
}
`)

const Container = styled.div`
width: 100%;
background: ${({ theme }) => theme.card.background};
Expand Down Expand Up @@ -154,13 +133,6 @@ const SortIcon = styled(Sort)`
cursor: pointer;
`

const MobileSortSelectors = styled.div`
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 12px;
margin-top: 12px;
`

const LAZY_NUMBER_OF_FARMS_VISIBLE = 12

const FarmTable: React.FC<ITableProps> = props => {
Expand All @@ -171,6 +143,7 @@ const FarmTable: React.FC<ITableProps> = props => {
const [colSortBy, setColSortBy] = useState({ columnName: "", iscAscOverride: false })
const [showMore, setShowMore] = React.useState(LAZY_NUMBER_OF_FARMS_VISIBLE)


const { rows: _rows, headers } = useTable(columns, data)

const rows = React.useMemo(() => {
Expand Down Expand Up @@ -207,29 +180,8 @@ const FarmTable: React.FC<ITableProps> = props => {

return (
<Container>
{
!isDesktop && (
<MobileSortSelectors >
<LabelWrapper>
<Text>Sort by</Text>
<Select
options={headers.filter(h => h.name !== "details" && h.name !== "actions").map(h => ({ label: h.label, value: h.name }))}
value={{ label: headers.find(h => h.name === colSortBy.columnName)?.label, value: colSortBy.columnName }}
onChange={(e) => setColSortBy({ ...colSortBy, columnName: e.value })}
/>
</LabelWrapper>
<LabelWrapper>
<Text>Sort order</Text>
<Select
options={[{ label: "Asc", value: false }, { label: "Desc", value: true }]}
value={{ label: colSortBy.iscAscOverride ? "Desc" : "Asc", value: colSortBy.iscAscOverride }}
onChange={(e) => setColSortBy({ ...colSortBy, iscAscOverride: e.value })}
/>
</LabelWrapper>
</MobileSortSelectors>
)
}
<TableContainer>

<TableWrapper ref={tableWrapperEl}>
<StyledTable isDesktop={isDesktop}>
{isDesktop ? (
Expand Down

0 comments on commit c3042ef

Please sign in to comment.