Emails
1 month ago
EngagementChart
1 month ago
MediaHub
1 month ago
Onboarding
1 month ago
Popup
1 month ago
Skeletons
1 week ago
WhatsNew
1 month ago
charts
1 month ago
test
1 month ago
AdminMenuSync.js
1 month ago
ChartEmptyState.js
1 month ago
ChooseDate.js
1 month ago
ColorPicker.js
1 month ago
ExtendPlugins.js
1 month ago
Filters.js
1 month ago
Link.js
1 month ago
Navbar.js
1 week ago
NoFound.js
1 month ago
PageHeader.js
1 month ago
PluginRecommendations.js
1 month ago
PostScheduleField.js
1 month ago
PrestoPlayerIcon.js
1 month ago
ProGateOverlay.js
1 month ago
QuickAccess.js
1 month ago
RankedTable.js
1 month ago
StatCard.js
1 month ago
TopMedia.js
1 month ago
TopPerformingMedia.js
1 month ago
TopUsers.js
1 month ago
TruncatedTitle.js
1 month ago
UpgradeNotice.js
1 month ago
UpgradeToPro.js
1 month ago
VideoModal.js
1 month ago
WelcomeBanner.js
1 month ago
PageHeader.js
70 lines
| 1 | /** |
| 2 | * Shared list-page header: title, optional filter toggle, search, primary action button. |
| 3 | * Matches MediaHub layout/design. Used by MediaHub and Emails. |
| 4 | */ |
| 5 | import React from "react"; |
| 6 | import { __ } from "@wordpress/i18n"; |
| 7 | import { Container, Title, Button } from "@bsf/force-ui"; |
| 8 | import { ListFilter, Plus } from "lucide-react"; |
| 9 | import SearchBar from "./MediaHub/SearchBar"; |
| 10 | |
| 11 | const PageHeader = ({ |
| 12 | title, |
| 13 | showFilter, |
| 14 | setShowFilter, |
| 15 | showFilterWhen, |
| 16 | searchPlaceholder, |
| 17 | searchValue, |
| 18 | onSearchChange, |
| 19 | searchInputRef, |
| 20 | primaryButtonText, |
| 21 | onPrimaryClick, |
| 22 | }) => ( |
| 23 | <Container className="w-full flex items-center justify-between"> |
| 24 | <Container.Item grow={1}> |
| 25 | <Title |
| 26 | description="" |
| 27 | icon={null} |
| 28 | iconPosition="right" |
| 29 | size="md" |
| 30 | tag="h4" |
| 31 | title={title} |
| 32 | /> |
| 33 | </Container.Item> |
| 34 | <Container.Item className="flex items-center gap-6"> |
| 35 | {showFilterWhen && ( |
| 36 | <Button |
| 37 | aria-label={__("Toggle filters", "presto-player")} |
| 38 | aria-pressed={showFilter} |
| 39 | icon={<ListFilter aria-label="icon" role="img" />} |
| 40 | iconPosition="left" |
| 41 | size="sm" |
| 42 | tag="button" |
| 43 | type="button" |
| 44 | variant={showFilter ? "primary" : "ghost"} |
| 45 | onClick={() => setShowFilter(!showFilter)} |
| 46 | /> |
| 47 | )} |
| 48 | <SearchBar |
| 49 | inputRef={searchInputRef} |
| 50 | value={searchValue} |
| 51 | onChange={onSearchChange} |
| 52 | placeholder={searchPlaceholder} |
| 53 | /> |
| 54 | <Button |
| 55 | icon={<Plus aria-label="icon" role="img" />} |
| 56 | iconPosition="left" |
| 57 | size="sm" |
| 58 | tag="button" |
| 59 | type="button" |
| 60 | variant="primary" |
| 61 | onClick={onPrimaryClick} |
| 62 | > |
| 63 | {primaryButtonText} |
| 64 | </Button> |
| 65 | </Container.Item> |
| 66 | </Container> |
| 67 | ); |
| 68 | |
| 69 | export default PageHeader; |
| 70 |