This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2096 from artsy/filter-nav-stack
Implement Initial Collections Artwork Filter Navigation Stack
- Loading branch information
Showing
8 changed files
with
352 additions
and
1,268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { ArrowLeftIcon, Box, Flex, Sans, Serif, space } from "@artsy/palette" | ||
import { BackgroundFill, OptionListItem } from "lib/Components/FilterModal" | ||
import React from "react" | ||
import { FlatList, TouchableOpacity } from "react-native" | ||
import NavigatorIOS from "react-native-navigator-ios" | ||
import styled from "styled-components/native" | ||
|
||
interface SortOptionsScreenProps { | ||
navigator: NavigatorIOS | ||
} | ||
|
||
export class SortOptionsScreen extends React.Component<SortOptionsScreenProps> { | ||
handleBackNavigation() { | ||
this.props.navigator.pop() | ||
} | ||
|
||
render() { | ||
return ( | ||
<Flex flexGrow={1}> | ||
<SortHeader> | ||
<Flex alignItems="flex-end" mt={0.5} mb={2}> | ||
<ArrowLeftIconContainer onPress={() => this.handleBackNavigation()}> | ||
<ArrowLeftIcon fill="black100" /> | ||
</ArrowLeftIconContainer> | ||
</Flex> | ||
<Sans mt={2} weight="medium" size="4"> | ||
Sort | ||
</Sans> | ||
<Box></Box> | ||
</SortHeader> | ||
<Flex> | ||
<FlatList<string> | ||
keyExtractor={(_item, index) => String(index)} | ||
data={SortOptions} | ||
renderItem={({ item }) => ( | ||
<Box> | ||
{ | ||
<OptionListItem> | ||
<Flex p={2} flexDirection="row" justifyContent="space-between" flexGrow={1}> | ||
<Serif size="3">{item}</Serif> | ||
</Flex> | ||
</OptionListItem> | ||
} | ||
</Box> | ||
)} | ||
/> | ||
</Flex> | ||
<BackgroundFill /> | ||
</Flex> | ||
) | ||
} | ||
} | ||
|
||
const SortOptions = [ | ||
"Default", | ||
"Price (low to high)", | ||
"Price (high to low)", | ||
"Recently Updated", | ||
"Recently Added", | ||
"Artwork year (descending)", | ||
"Artwork year (ascending)", | ||
] | ||
|
||
export const SortHeader = styled(Flex)` | ||
flex-direction: row; | ||
justify-content: space-between; | ||
padding-right: ${space(2)}; | ||
` | ||
|
||
export const ArrowLeftIconContainer = styled(TouchableOpacity)` | ||
margin-top: ${space(2)}; | ||
margin-left: ${space(2)}; | ||
` |
24 changes: 24 additions & 0 deletions
24
src/lib/Components/ArtworkFilterOptions/__tests__/SortOptions-tests.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Theme } from "@artsy/palette" | ||
import { FakeNavigator as MockNavigator } from "lib/Components/Bidding/__tests__/Helpers/FakeNavigator" | ||
import { OptionListItem } from "lib/Components/FilterModal" | ||
import React from "react" | ||
import * as renderer from "react-test-renderer" | ||
import { SortOptionsScreen as SortOptions } from "../SortOptions" | ||
|
||
describe("Sort Options Screen", () => { | ||
let mockNavigator: MockNavigator | ||
|
||
beforeEach(() => { | ||
mockNavigator = new MockNavigator() | ||
}) | ||
|
||
it("renders the correct number of sort options", () => { | ||
const root = renderer.create( | ||
<Theme> | ||
<SortOptions navigator={mockNavigator as any} /> | ||
</Theme> | ||
).root | ||
|
||
expect(root.findAllByType(OptionListItem)).toHaveLength(7) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.