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

Question: Custom result list rendering #1406

Closed
traverse opened this issue Mar 1, 2017 · 3 comments
Closed

Question: Custom result list rendering #1406

traverse opened this issue Mar 1, 2017 · 3 comments

Comments

@traverse
Copy link
Contributor

traverse commented Mar 1, 2017

I was wondering if it's possible to render a custom result list. I know it's possible to render custom results
and custom search inputs but if I for example require a "Click here to see all the results" button in my result list because rendering 200 results isn't really viable. What would in this case be the most appropriate solution?

@levithomason
Copy link
Member

Hm, could you post some example pseudo code of what you're to accomplish and the desired output?

@traverse
Copy link
Contributor Author

traverse commented Mar 2, 2017

I would like to do something like the following:

<Search>
    <Search.Input />
    <Search.Results>
        { results.map(result => <Search.Result /> }
        <CustomComponent />
    <Search.Results />
</Search>

Where output should something along the lines of:

<div class="ui search">
    <div class="ui icon input">
        <input type="text" class="prompt">
        <i class="search icon"></i>
    </div>
    <div class="results transition">
        <div class="result">...</div>
        ...
        <!-- my CustomComponent -->
        <a href="/to/results">go to results page</a> 
    </div>
</div>

So the output is basically a default search component but you can add custom things to the result list easily. At the moment I solved it by pushing an extra item to the results array if there are more than 10 results. This solution however is in my opinion not a very clean way to do it, if you have any other solutions I'm all ears. 👍

@levithomason
Copy link
Member

At the moment I solved it by pushing an extra item to the results array if there are more than 10 results.

This is actually precisely what I would recommend :) Reason being, it is the only way to get supported markup and behavior. Will close for housekeeping. If anyone comes up with a better idea, I'd love to hear it and review a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants