|
|
|
|
@ -10,12 +10,22 @@ import ActionButton, { ActionButtonState } from '@/app/components/base/action-bu
|
|
|
|
|
type EditSliceProps = SliceProps<{
|
|
|
|
|
label: ReactNode
|
|
|
|
|
onDelete: () => void
|
|
|
|
|
labelClassName?: string
|
|
|
|
|
labelInnerClassName?: string
|
|
|
|
|
contentClassName?: string
|
|
|
|
|
showDivider?: boolean
|
|
|
|
|
}>
|
|
|
|
|
|
|
|
|
|
export const EditSlice: FC<EditSliceProps> = (props) => {
|
|
|
|
|
const { label, className, text, onDelete, labelClassName, contentClassName, ...rest } = props
|
|
|
|
|
const {
|
|
|
|
|
label,
|
|
|
|
|
className,
|
|
|
|
|
text,
|
|
|
|
|
onDelete,
|
|
|
|
|
labelInnerClassName,
|
|
|
|
|
contentClassName,
|
|
|
|
|
showDivider = true,
|
|
|
|
|
...rest
|
|
|
|
|
} = props
|
|
|
|
|
const [delBtnShow, setDelBtnShow] = useState(false)
|
|
|
|
|
const [isDelBtnHover, setDelBtnHover] = useState(false)
|
|
|
|
|
|
|
|
|
|
@ -37,7 +47,7 @@ export const EditSlice: FC<EditSliceProps> = (props) => {
|
|
|
|
|
const isDestructive = delBtnShow && isDelBtnHover
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<span className='inline-block'>
|
|
|
|
|
<SliceContainer {...rest}
|
|
|
|
|
className={className}
|
|
|
|
|
ref={refs.setReference}
|
|
|
|
|
@ -46,8 +56,8 @@ export const EditSlice: FC<EditSliceProps> = (props) => {
|
|
|
|
|
<SliceLabel
|
|
|
|
|
className={classNames(
|
|
|
|
|
isDestructive && '!bg-state-destructive-solid !text-text-primary-on-surface',
|
|
|
|
|
labelClassName,
|
|
|
|
|
)}
|
|
|
|
|
labelInnerClassName={labelInnerClassName}
|
|
|
|
|
>
|
|
|
|
|
{label}
|
|
|
|
|
</SliceLabel>
|
|
|
|
|
@ -59,11 +69,11 @@ export const EditSlice: FC<EditSliceProps> = (props) => {
|
|
|
|
|
>
|
|
|
|
|
{text}
|
|
|
|
|
</SliceContent>
|
|
|
|
|
<SliceDivider
|
|
|
|
|
{showDivider && <SliceDivider
|
|
|
|
|
className={classNames(
|
|
|
|
|
isDestructive && '!bg-state-destructive-hover-alt',
|
|
|
|
|
)}
|
|
|
|
|
/>
|
|
|
|
|
/>}
|
|
|
|
|
{delBtnShow && <FloatingFocusManager
|
|
|
|
|
context={context}
|
|
|
|
|
>
|
|
|
|
|
@ -88,6 +98,6 @@ export const EditSlice: FC<EditSliceProps> = (props) => {
|
|
|
|
|
</div>
|
|
|
|
|
</FloatingFocusManager>}
|
|
|
|
|
</SliceContainer>
|
|
|
|
|
</div>
|
|
|
|
|
</span>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|