/*
MobileHeaderTitleIcon can be used in MobileHeaderComponent's Center part.
It has it's own Left and Right icons.
*/
import { VNode, CssProps, HtmlVar, backActionHelper } from 'lupine.components';
export const MobileHeadeIconHeight = '40px';
export const MobileHeadeBackIcon = ({ onClick }: { onClick: (event: Event) => void }) => {
return (
onClick(event)}
>
);
};
export const MobileHeadeCloseIcon = ({ onClick }: { onClick: (event: Event) => void }) => {
return (
onClick(event)}
>
);
};
export const MobileHeaderEmptyIcon = () => {
return
;
};
export interface MobileHeaderTitleIconProps {
title: VNode | string | HtmlVar;
onBack?: (event: Event) => void;
left?: VNode | HtmlVar;
right?: VNode | HtmlVar;
background?: string;
color?: string;
noShadow?: boolean;
}
// there may have a few MobileHeaderTitleIcon for different pages
export const MobileHeaderTitleIcon = ({
title,
onBack,
left,
right,
background,
color,
noShadow,
}: MobileHeaderTitleIconProps) => {
// const processBack = (event: Event) => {
// if (onBack) {
// onBack(event);
// }
// };
// left = left || ;
// right = right || ;
const css: CssProps = {
display: 'flex',
flexDirection: 'row',
width: '100%',
padding: '6px 0',
// backgroundColor: 'var(--activatable-bg-color-normal)',
// boxShadow: 'var(--mobile-header-shadow)',
color: color || 'var(--primary-color)',
background: background || 'var(--activatable-bg-color-normal)',
boxShadow: noShadow ? 'unset' : 'var(--mobile-header-shadow)',
position: 'relative',
zIndex: 'var(--layer-inside)', // bring boxShadow to front
'.mhti-title': {
display: 'flex',
fontSize: '1.3rem',
flex: '1',
color: 'var(--activatable-text-color-normal)',
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
alignItems: 'center',
justifyContent: 'center',
},
'.mhti-title > *': {
display: 'flex',
width: '100%',
alignItems: 'center',
justifyContent: 'center',
},
'.mhti-left, .mhti-right': {
height: MobileHeadeIconHeight,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
cursor: 'pointer',
fontSize: '16px',
},
'.mhti-left': {
paddingLeft: '8px',
},
'.mhti-right': {
paddingRight: '8px',
},
'.mhti-left i, .mhti-right i': {
fontSize: '28px',
},
};
const domLeft = left instanceof HtmlVar ? left : new HtmlVar(left);
const domCenter = title instanceof HtmlVar ? title : new HtmlVar(title);
const domRight = right instanceof HtmlVar ? right : new HtmlVar(right);
return (
);
};