[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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,26 @@
|
||||
import React from "react";
|
||||
import React, { useCallback } from "react";
|
||||
|
||||
import classNames from "classnames";
|
||||
|
||||
import Switch from "../../../node_modules/@enact/sandstone/Switch/Switch";
|
||||
import css from "../TSwitch/TSwitch.module.less";
|
||||
|
||||
export default function TSwitch({ className, onClick }) {
|
||||
export default function TSwitch({ disabled, className, onClick }) {
|
||||
const _onClick = useCallback(
|
||||
(e) => {
|
||||
if (disabled) {
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
if (onClick) {
|
||||
onClick(e);
|
||||
}
|
||||
},
|
||||
[onClick, disabled]
|
||||
);
|
||||
|
||||
return (
|
||||
<Switch className={classNames(css.tSwitch, className)} onClick={onClick} />
|
||||
<Switch className={classNames(css.tSwitch, className)} onClick={_onClick} />
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
margin: 0 0 0 10px !important;
|
||||
|
||||
> div {
|
||||
&:first-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
width: 112px;
|
||||
height: 53px;
|
||||
|
||||
Reference in New Issue
Block a user