- youmayalsolike 파트너사 21일때는 노출하지않음. - see more product 쉘프에 스폰서 이미지 추가 - see more product 쉘프에 쉘프명 수정.
104 lines
2.3 KiB
JavaScript
104 lines
2.3 KiB
JavaScript
import React, {
|
|
useCallback,
|
|
useMemo,
|
|
} from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import { Marquee } from '@enact/sandstone/Marquee';
|
|
import SpotlightContainerDecorator
|
|
from '@enact/spotlight/SpotlightContainerDecorator';
|
|
import Spottable from '@enact/spotlight/Spottable';
|
|
|
|
import { $L } from '../../utils/helperMethods';
|
|
import css from './THeader.module.less';
|
|
|
|
const Container = SpotlightContainerDecorator(
|
|
{ enterTo: "last-focused" },
|
|
"div"
|
|
);
|
|
const SpottableComponent = Spottable("button");
|
|
|
|
export default function THeader({
|
|
title,
|
|
className,
|
|
onBackButton,
|
|
onSpotlightUp,
|
|
onSpotlightLeft,
|
|
marqueeDisabled = true,
|
|
onClick,
|
|
ariaLabel,
|
|
children,
|
|
kind,
|
|
sponserImage,
|
|
...rest
|
|
}) {
|
|
const convertedTitle = useMemo(() => {
|
|
if (title) {
|
|
const cleanedTitle = title.replace(/(\r\n|\n)/g, "");
|
|
return $L(marqueeDisabled ? title : cleanedTitle);
|
|
}
|
|
}, [marqueeDisabled, title]);
|
|
|
|
const _onClick = useCallback(
|
|
(e) => {
|
|
if (onClick) {
|
|
onClick(e);
|
|
}
|
|
},
|
|
[onClick]
|
|
);
|
|
|
|
const _onSpotlightUp = (e) => {
|
|
if (onSpotlightUp) {
|
|
onSpotlightUp(e);
|
|
}
|
|
};
|
|
|
|
const _onSpotlightLeft = (e) => {
|
|
if (onSpotlightLeft) {
|
|
onSpotlightLeft(e);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Container className={classNames(css.tHeader, className)} {...rest}>
|
|
{onBackButton && (
|
|
<SpottableComponent
|
|
className={css.button}
|
|
onClick={_onClick}
|
|
spotlightId={"spotlightId_backBtn"}
|
|
onSpotlightUp={_onSpotlightUp}
|
|
onSpotlightLeft={_onSpotlightLeft}
|
|
aria-label="Back"
|
|
role="button"
|
|
/>
|
|
)}
|
|
|
|
<Marquee
|
|
marqueeOn="render"
|
|
className={kind === "cartPanel" ? css.cartTitle : css.title}
|
|
marqueeDisabled={marqueeDisabled}
|
|
aria-label={ariaLabel}
|
|
>
|
|
{convertedTitle && (
|
|
<span dangerouslySetInnerHTML={{ __html: convertedTitle }} />
|
|
)}
|
|
</Marquee>
|
|
|
|
{children}
|
|
{sponserImage &&(
|
|
<div className={css.sponserImgBox}>
|
|
<CustomImage
|
|
src={sponserImage}
|
|
className={css.sponserImg}
|
|
/>
|
|
<div className={css.sponserTextBox}>
|
|
SPONSORED BY
|
|
</div>
|
|
</div>
|
|
)}
|
|
</Container>
|
|
);
|
|
}
|