lbry-desktop/ui/component/wunderbar/view.jsx

32 lines
957 B
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
2018-11-26 02:21:25 +01:00
import * as ICONS from 'constants/icons';
import React from 'react';
2020-12-11 19:33:27 +01:00
import { useIsMobile } from 'effects/use-screensize';
2021-06-11 08:06:29 +02:00
2021-10-19 04:31:23 +02:00
import Button from 'component/button';
import WunderbarSuggestions from 'component/wunderbarSuggestions';
2018-10-04 07:59:47 +02:00
2018-03-26 23:32:43 +02:00
type Props = {
2021-06-16 04:27:58 +02:00
doOpenMobileSearch: (any) => void,
2021-06-03 04:59:01 +02:00
channelsOnly?: boolean,
noTopSuggestion?: boolean,
noBottomLinks?: boolean,
customSelectAction?: (string) => void,
2018-03-26 23:32:43 +02:00
};
2020-12-03 18:29:47 +01:00
export default function WunderBar(props: Props) {
2021-06-03 04:59:01 +02:00
const { doOpenMobileSearch, channelsOnly, noTopSuggestion, noBottomLinks, customSelectAction } = props;
2020-12-11 19:33:27 +01:00
const isMobile = useIsMobile();
2020-12-03 18:29:47 +01:00
2020-12-11 19:33:27 +01:00
return isMobile ? (
2021-10-19 04:31:23 +02:00
<Button icon={ICONS.SEARCH} className="wunderbar__mobile-search" onClick={() => doOpenMobileSearch({ ...props })} />
2020-12-11 19:33:27 +01:00
) : (
2021-10-19 04:31:23 +02:00
<WunderbarSuggestions
channelsOnly={channelsOnly}
noTopSuggestion={noTopSuggestion}
noBottomLinks={noBottomLinks}
customSelectAction={customSelectAction}
/>
2020-12-03 18:29:47 +01:00
);
}