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

enhancement request on cards layout #22

Open
viseth opened this issue Dec 5, 2019 · 2 comments
Open

enhancement request on cards layout #22

viseth opened this issue Dec 5, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@viseth
Copy link

viseth commented Dec 5, 2019

Hi @zzseba78,

Thanks for keeping updated with the Ulkit version.
It would be a nice feature to have the cards filter with a list of pattern or tags. Currently only one seems to be possible.

Something like below, which would filter out the music cards and the photography cards.

image

how does it sounds ?

Thanks,

Regards,

Viseth

@zzseba78 zzseba78 added the enhancement New feature or request label Feb 1, 2020
@PaulFelge
Copy link

PaulFelge commented Apr 29, 2020

You can use the group function and use it like this for example (this would also work to filter by text and by pills/tags):
filter: []; group:

cards.js

so for the text you need to adjust the cards.js:

UIkit.util.on(search, 'keyup', function() {
	clearTimeout(debounce);
	debounce = setTimeout(function() {
		var value = search.value;
		var finalValue = value.toLowerCase();
		var searchTerm = '';

		if (value.length) searchTerm = 'filter: [data-tags*="' + finalValue + '" i]; group: text';
		UIkit.util.attr(searchVal, 'uk-filter-control', searchTerm);
		searchVal.click();
	}, 300);
});

the "i" in the data attribute selector helps with being not case-sensitive and you could get rid of the value.toLowerCase();
if (value.length) searchTerm = 'filter: [data-tags*="' + finalValue + '" i]; group: text';

cards.html

<ul class="uk-subnav uk-subnav-pill">
 <li class="uk-active" data-uk-filter-control><a href="#">Show All</a></li>
 <li uk-filter-control="filter: .nature-card; group: nature"><a href="#">Nature</a></li>
 <li uk-filter-control="filter:.music-card; group: music"><a href="#">Music</a></li>
 <li uk-filter-control="filter:.photo-card; group: photo"><a href="#">Photography</a></li>
 <li uk-filter-control="filter:.design-card; group: design"><a href="#">Design</a></li>
</ul>

If you want I can make a branch to demonstrate it. Also at the moment you can search only for text that is in the exact order, I found a way to tackle this as well.

@viseth
Copy link
Author

viseth commented Dec 23, 2020

Hi @PaulFelge,

Thanks for the reply, how do you handle the tag split caracter in your case ? For example : music, photography ?
Indeed the search value is a input field, so the search.value is a string.

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

No branches or pull requests

3 participants