/*
HeaderWithBackFrame is a full page frame with header for mobile sliders.
It has Back icon at Left and Close icon at Right.
*/
import { VNode, CssProps, RefProps, HtmlVar, backActionHelper } from 'lupine.components';
import { MobileHeaderTitleIcon } from './mobile-header-title-icon';
export const HeaderWithBackFrameHeight = '40px';
export const HeaderWithBackFrameLeft = ({ onClick }: { onClick: (event: Event) => void }) => {
return (
);
};
export const HeaderWithBackFrameRight = ({ onClick }: { onClick: (event: Event) => void }) => {
return (
);
};
export const HeaderWithBackFrameEmpty = () => {
return
;
};
// there may have a few HeaderWithBackFrame one over another at the same time
export const HeaderWithBackFrame = ({
children,
title,
onBack,
left,
right,
noHeader = false,
background,
color,
noShadow,
contentColor,
contentBackground,
}: {
children: VNode;
title: VNode | string | HtmlVar;
onBack: (event: Event) => void;
left?: VNode | HtmlVar;
right?: VNode | HtmlVar;
noHeader?: boolean;
color?: string;
background?: string;
noShadow?: boolean;
contentColor?: string;
contentBackground?: string;
}) => {
left = left || ;
right = right || ;
const css: CssProps = {
display: 'flex',
flexDirection: 'column',
width: '100%',
height: '100%',
minHeight: '100%',
background: background || 'var(--activatable-bg-color-normal)',
'.header-back-top': {
display: 'flex',
flexDirection: 'row',
width: '100%',
padding: '6px 0',
backgroundColor: 'var(--activatable-bg-color-normal)',
boxShadow: 'var(--mobile-header-shadow)',
},
'.header-back-content': {
display: 'flex',
flex: '1',
flexDirection: 'column',
overflowY: 'auto',
scrollbarWidth: 'none',
position: 'relative',
color: contentColor || 'var(--primary-color)',
background: contentBackground || 'var(--activatable-bg-color-normal)',
'&::-webkit-scrollbar': {
display: 'none',
// height: '0',
},
},
'.header-back-title': {
fontSize: '15px',
flex: '1',
color: 'var(--activatable-text-color-normal)',
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
},
'.header-back-left, .header-back-right': {
// width: HeaderWithBackFrameHeight,
height: HeaderWithBackFrameHeight,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
cursor: 'pointer',
fontSize: '16px',
padding: '0 8px',
},
'.header-back-left i, .header-back-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);
const ref: RefProps = {};
return (
);
};