更新色卡组件中的样式,增加ContextMenu功能。
This commit is contained in:
parent
6643eae433
commit
e32eed405f
|
@ -8,7 +8,6 @@
|
||||||
line-height: var(--font-size-xxs);
|
line-height: var(--font-size-xxs);
|
||||||
border: 1px solid var(--color-border);
|
border: 1px solid var(--color-border);
|
||||||
border-radius: var(--border-radius-xs);
|
border-radius: var(--border-radius-xs);
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
.color_block {
|
.color_block {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -19,6 +18,7 @@
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: var(--spacing-xs) var(--spacing-s);
|
padding: var(--spacing-xs) var(--spacing-s);
|
||||||
|
gap: var(--spacing-s);
|
||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -38,5 +38,6 @@
|
||||||
}
|
}
|
||||||
.color_value {
|
.color_value {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { capitalize, isEmpty } from 'lodash-es';
|
import { capitalize, isEmpty } from 'lodash-es';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useColorFunction } from '../../ColorFunctionContext';
|
import { useColorFunction } from '../../ColorFunctionContext';
|
||||||
|
import ContextMenu from '../../components/ContextMenu';
|
||||||
import { useCopyColor } from '../../hooks/useCopyColor';
|
import { useCopyColor } from '../../hooks/useCopyColor';
|
||||||
import { ColorDescription } from '../../models';
|
import { ColorDescription } from '../../models';
|
||||||
import styles from './ColorCard.module.css';
|
import styles from './ColorCard.module.css';
|
||||||
|
@ -57,7 +58,7 @@ export function ColorCard({ color, copyMode }: ColorCardProps) {
|
||||||
}, [copytToClipboard, color, copyMode, colorHex]);
|
}, [copytToClipboard, color, copyMode, colorHex]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.card} onClick={handleCopy}>
|
<div className={styles.card}>
|
||||||
<div
|
<div
|
||||||
className={styles.color_block}
|
className={styles.color_block}
|
||||||
style={{ backgroundColor: `rgb(${color.rgb[0]}, ${color.rgb[1]}, ${color.rgb[2]})` }}
|
style={{ backgroundColor: `rgb(${color.rgb[0]}, ${color.rgb[1]}, ${color.rgb[2]})` }}
|
||||||
|
@ -69,7 +70,10 @@ export function ColorCard({ color, copyMode }: ColorCardProps) {
|
||||||
<span className={styles.en_name}>{color.pinyin.map(capitalize).join(' ')}</span>
|
<span className={styles.en_name}>{color.pinyin.map(capitalize).join(' ')}</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.color_value}>#{colorHex}</div>
|
<div className={styles.color_value} onClick={handleCopy}>
|
||||||
|
#{colorHex}
|
||||||
|
</div>
|
||||||
|
<ContextMenu color={colorHex} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user