[THeader, TSwitch] TSwitch 로직 변경 및, THeader Children 추가
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React from "react";
|
||||
import React, { useCallback } from "react";
|
||||
|
||||
import classNames from "classnames";
|
||||
|
||||
@@ -12,13 +12,30 @@ const Container = SpotlightContainerDecorator(
|
||||
"div"
|
||||
);
|
||||
const SpottableComponent = Spottable("button");
|
||||
export default function THeader({ title, className, onBackButton, onClick }) {
|
||||
|
||||
export default function THeader({
|
||||
title,
|
||||
className,
|
||||
onBackButton,
|
||||
onClick,
|
||||
children,
|
||||
}) {
|
||||
const _onClick = useCallback(
|
||||
(e) => {
|
||||
if (onClick) {
|
||||
onClick(e);
|
||||
}
|
||||
},
|
||||
[onClick]
|
||||
);
|
||||
|
||||
return (
|
||||
<Container className={classNames(css.tHeader, className)}>
|
||||
{onBackButton && (
|
||||
<SpottableComponent className={css.button} onClick={onClick} />
|
||||
<SpottableComponent className={css.button} onClick={_onClick} />
|
||||
)}
|
||||
<div className={css.title}>{title}</div>
|
||||
{children}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user