PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / Admin / components / Header / index.tsx

index.tsx in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Admin/components/Header/index.tsx

53 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from 'react';
2 import styles from './styles.module.scss';
3
4 /**
5 * @since 4.4.0
6 */
7 type HeaderProps = {
8 children?: React.ReactNode;
9 title: string;
10 subtitle?: string;
11 href?: string;
12 actionText?: string;
13 actionOnClick?: () => void;
14 };
15
16 /**
17 * @since 4.4.0
18 */
19 export default function Header({title, subtitle, href, actionText, actionOnClick}: HeaderProps) {
20 return (
21 <header className={styles.header}>
22 <div>
23 <HeaderText>{title}</HeaderText>
24 {subtitle && <SubHeaderText>{subtitle}</SubHeaderText>}
25 </div>
26 {href && !actionOnClick && (
27 <a className={styles.action} href={href} rel={'noreferrer'} aria-label={`${actionText} for ${title}`}>
28 {actionText}
29 </a>
30 )}
31 {actionOnClick && !href && (
32 <button className={styles.action} onClick={actionOnClick} aria-label={`${actionText} for ${title}`}>
33 {actionText}
34 </button>
35 )}
36 </header>
37 );
38 }
39
40 /**
41 * @since 4.4.0
42 */
43 export function HeaderText({children}: {children: React.ReactNode}) {
44 return <h2 className={styles.headerText}>{children}</h2>;
45 }
46
47 /**
48 * @since 4.4.0
49 */
50 export function SubHeaderText({children}: {children: React.ReactNode}) {
51 return <p className={styles.subHeaderText}>{children}</p>;
52 }
53