Skip to content

Commit

Permalink
fix(colorpicker): remove swatchs panel default title (#1810)
Browse files Browse the repository at this point in the history
* feat: add preset&recent when color change

* fix(colorpicker): remove swatches default title

* feat: update common
  • Loading branch information
josonyang authored Dec 22, 2022
1 parent af42293 commit d8b72cb
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions src/color-picker/components/panel/swatches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@ export interface TdColorSwathcesProps extends TdColorBaseProps {
}

const Swatches = (props: TdColorSwathcesProps) => {
const {
baseClassName,
colors = [],
title = '系统色彩',
editable = false,
onChange,
disabled,
onSetColor,
handleAddColor,
} = props;
const { baseClassName, colors = [], editable = false, title, onChange, disabled, onSetColor, handleAddColor } = props;
const { DeleteIcon, AddIcon } = useGlobalIcon({ DeleteIcon: TdDeleteIcon, AddIcon: TdAddIcon });
const swatchesClass = `${baseClassName}__swatches`;
const { STATUS: statusClassNames } = useCommonClassName();
Expand All @@ -44,21 +35,25 @@ const Swatches = (props: TdColorSwathcesProps) => {

return (
<div className={swatchesClass}>
<h3 className={`${swatchesClass}--title`}>
<span>{title}</span>
{editable && (
<div className={`${swatchesClass}--actions`}>
<span role="button" className={`${baseClassName}__icon`} onClick={() => handleAddColor()}>
<AddIcon />
</span>
{colors.length > 0 ? (
<span role="button" className={`${baseClassName}__icon`} onClick={() => handleRemoveColor()}>
<DeleteIcon />
{title ? (
<h3 className={`${swatchesClass}--title`}>
<span>{title}</span>
{editable && (
<div className={`${swatchesClass}--actions`}>
<span role="button" className={`${baseClassName}__icon`} onClick={() => handleAddColor()}>
<AddIcon />
</span>
) : null}
</div>
)}
</h3>
{colors.length > 0 ? (
<span role="button" className={`${baseClassName}__icon`} onClick={() => handleRemoveColor()}>
<DeleteIcon />
</span>
) : null}
</div>
)}
</h3>
) : (
<></>
)}
<ul className={classnames(`${swatchesClass}--items`, 'narrow-scrollbar')}>
{colors.map((color) => (
<li
Expand Down

0 comments on commit d8b72cb

Please sign in to comment.