react-carousel-query
Version:
A infinite carousel component made with react that handles the pagination for you.
27 lines • 653 B
JavaScript
export const getSelectedItem = ({
currentValue,
items
}) => {
const selectedItem = currentValue != null && items.find(item => item.value === currentValue);
return selectedItem;
};
export const getSelectedIcon = ({
currentValue,
items
}) => {
const selectedItem = getSelectedItem({
currentValue,
items
});
return selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon;
};
export const getSelectedTitle = ({
currentValue,
items
}) => {
const selectedItem = getSelectedItem({
currentValue,
items
});
return selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.title;
};