Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr/108 #254

Merged
merged 32 commits into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2309066
Open a stub search box on "Add Dependency" click
tansongyang Oct 19, 2017
9a298ea
Connect to yarn's npm index
tansongyang Oct 21, 2017
f919431
Add click handler to hits
tansongyang Oct 21, 2017
a3691f7
Control InstantSearch
tansongyang Oct 21, 2017
b24892b
Populate version dropdown on select
tansongyang Oct 21, 2017
4450565
Add dependency on confirm
tansongyang Oct 21, 2017
b4fe375
Add search box autofocus
tansongyang Oct 21, 2017
6952460
Styled left side of dependency search results
tansongyang Nov 20, 2017
3db67ca
Merge branch 'master' into pr/108
tansongyang Nov 23, 2017
c9211f6
Move pr/108 files to new locations
Nov 26, 2017
3261729
Format download count
Nov 26, 2017
c79f280
Limit hits per page
Nov 26, 2017
36a97d6
Add GitHub link
Nov 26, 2017
e9c9fbd
Add homepage link (and tooltips)
Nov 26, 2017
9918629
Add version select
Nov 26, 2017
d2b3b4b
Style dependency search box
Nov 26, 2017
f19555d
Make lines between dependencies softer
Nov 26, 2017
2363310
Include version in DependencyHit onClick
Nov 26, 2017
0f9006c
Support "Enter" click on DependencyHit
Nov 26, 2017
2df75e7
Restore add dependency functionality
Nov 26, 2017
ad4e9b3
Use codesandbox API key for Algolia search
Dec 2, 2017
a339148
Use Downshift for hit list
Dec 3, 2017
7598f0a
Refactor to remove unnecesary array
Dec 3, 2017
df686ce
Style search box
Dec 3, 2017
5452592
Focus search box
Dec 3, 2017
8dfa794
Add pagination controls
Dec 3, 2017
78cac5a
Move pagination under search bar
Dec 3, 2017
1a4732c
Add to contributors
Dec 3, 2017
3a81a8d
Merge branch 'master' into pr/108
Dec 4, 2017
66853a8
Fix lint errors
Dec 4, 2017
6e5bc79
Clean code
Dec 4, 2017
c3febdc
Re-add to contributors
Dec 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add pagination controls
  • Loading branch information
root authored and root committed Dec 3, 2017
commit 8dfa794778875cc520ad8bd6ce768b59d8f1eb49
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@
*/
background: transparent;
}

.ais-Pagination__root {
border-top-left-radius: 0;
border-top-right-radius: 0;
display: flex;
justify-content: center;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { InstantSearch, Configure } from 'react-instantsearch/dom';
import { InstantSearch, Configure, Pagination } from 'react-instantsearch/dom';
import { connectAutoComplete } from 'react-instantsearch/connectors';
import Downshift from 'downshift';
import styled from 'styled-components';
Expand All @@ -13,17 +13,8 @@ type Props = {
onConfirm: (dependency: string, version: string) => Promise<boolean>,
};

type State = {
searchState: Object,
};

const initialState: State = {
searchState: {},
};

export default class SearchDependencies extends React.PureComponent {
props: Props;
state = initialState;
hitToVersionMap = new Map();

handleSelect = hit => {
Expand All @@ -36,7 +27,6 @@ export default class SearchDependencies extends React.PureComponent {
};

render() {
const { searchState } = this.state;
return (
<InstantSearch
appId="OFCNCOG2CU"
Expand All @@ -49,6 +39,7 @@ export default class SearchDependencies extends React.PureComponent {
onHitClick={this.handleHitClick}
onHitVersionChange={this.handleHitVersionChange}
/>
<Pagination />
</InstantSearch>
);
}
Expand Down Expand Up @@ -89,25 +80,23 @@ function RawAutoComplete({
},
})}
/>
{!!currentRefinement && (
<div>
{hits.map((hit, index) => (
<DependencyHit
key={hit.name}
{...getItemProps({
item: hit,
index,
highlighted: highlightedIndex === index,
hit: hit,
/* Downshift supplies onClick */
onVersionChange(version) {
onHitVersionChange(hit, version);
},
})}
/>
))}
</div>
)}
<div>
{hits.map((hit, index) => (
<DependencyHit
key={hit.name}
{...getItemProps({
item: hit,
index,
highlighted: highlightedIndex === index,
hit: hit,
/* Downshift supplies onClick */
onVersionChange(version) {
onHitVersionChange(hit, version);
},
})}
/>
))}
</div>
</div>
)}
</Downshift>
Expand Down