Skip to content

Commit

Permalink
Merge pull request #13 from conversionxl/pawel/feat/custom-buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelkmpt authored Nov 4, 2024
2 parents 746b4cf + 38559b2 commit b250968
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/ui-react/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type Props = {
favoritesEnabled?: boolean;
siteName?: string;
navItems?: NavItem[];
beforeItems?: CustomMenuItem[];
afterItems?: CustomMenuItem[];

profilesData?: {
currentProfile: Profile | null;
Expand Down Expand Up @@ -112,6 +114,8 @@ const Header: React.FC<Props> = ({
navItems = [],
isOAuthMode,
rightSideItems,
beforeItems = [],
afterItems = [],
}) => {
const { t } = useTranslation('menu');
const [logoLoaded, setLogoLoaded] = useState(false);
Expand Down Expand Up @@ -231,13 +235,26 @@ const Header: React.FC<Props> = ({
if (navItems.length === 0) {
return children;
}

return (
<ul>
{beforeItems.length > 0 &&
beforeItems.map((item, index) => (
<li key={index}>
<Button activeClassname={styles.navButton} label={item.label} to={item.url} variant="text" />
</li>
))}
{navItems.map((item, index) => (
<li key={index}>
<Button activeClassname={styles.navButton} label={item.label} to={item.to} variant="text" />
</li>
))}
{afterItems.length > 0 &&
afterItems.map((item, index) => (
<li key={index}>
<Button activeClassname={styles.navButton} label={item.label} to={item.url} variant="text" />
</li>
))}
</ul>
);
};
Expand Down
2 changes: 2 additions & 0 deletions packages/ui-react/src/containers/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ const Layout = () => {
}}
navItems={navItems}
isOAuthMode={isOAuthMode}
beforeItems={beforeItems}
afterItems={afterItems}
>
<Button activeClassname={styles.headerButton} label={t('home')} to="/" variant="text" />
{menu.map((item) => (
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-react/src/hooks/useCustomCTAButtons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useMemo } from 'react';
import type { CTAItem } from '../components/CTAButton/CTAButton';

const useCustomCtaButtons = (player: any) => {
const itemData = player.props.seriesItem;
const itemData = player.props.seriesItem || player.props.item;

// Check and setup CTAs
const customItems = useMemo(() => {
Expand Down

0 comments on commit b250968

Please sign in to comment.