import React, { Children } from 'react';
import ConditionalWrapper from '../../common/ConditionalWrapper';
import { SiteFooterLicenseProps, SiteFooterLinkProps, SiteFooterOrgProps, SiteFooterProps } from './types';
import clsx from 'clsx';
const License = ({
children,
...props
}: SiteFooterLicenseProps) => {
return (
{children}
);
}
const Links = ({
children,
...props
}: React.AllHTMLAttributes) => {
return (
);
}
const Link = ({
children,
href,
linkComponent,
...props
}: SiteFooterLinkProps) => {
function processChildren(children: React.ReactNode) {
if (linkComponent) {
return linkComponent({ href, children });
} else if (href) {
return {children};
} else {
return children;
}
}
return
{processChildren(children)}
;
}
const Org = ({
href,
title,
children,
...props
}: SiteFooterOrgProps) => {
children = Children.map(children, child => {
const thisChild = child as React.ReactElement;
if (thisChild && ['img', 'svg', 'picture'].includes(thisChild.type as string)) {
return React.cloneElement(thisChild, { className: 'ds_site-footer__org-logo' });
} else {
return child;
}
});
return (
);
}
const SiteFooter = ({
children,
className,
...props
}: SiteFooterProps) => {
return (
);
};
SiteFooter.Links = Links;
SiteFooter.Link = Link;
SiteFooter.License = License;
SiteFooter.Org = Org;
SiteFooter.displayName = 'SiteFooter';
Links.displayName = 'SiteFooter.Links';
Link.displayName = 'SiteFooter.Link';
License.displayName = 'SiteFooter.License';
Org.displayName = 'SiteFooter.Org';
export default SiteFooter;