Update message context menu styles (#10487)
This commit is contained in:
@@ -761,6 +761,7 @@ export function Item({
|
|||||||
style,
|
style,
|
||||||
onPress,
|
onPress,
|
||||||
position,
|
position,
|
||||||
|
destructive = false,
|
||||||
...rest
|
...rest
|
||||||
}: ItemProps) {
|
}: ItemProps) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
@@ -819,8 +820,8 @@ export function Item({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const itemContext = useMemo(
|
const itemContext = useMemo(
|
||||||
() => ({disabled: Boolean(rest.disabled)}),
|
() => ({disabled: Boolean(rest.disabled), destructive}),
|
||||||
[rest.disabled],
|
[rest.disabled, destructive],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -872,7 +873,7 @@ export function Item({
|
|||||||
|
|
||||||
export function ItemText({children, style}: ItemTextProps) {
|
export function ItemText({children, style}: ItemTextProps) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {disabled} = useContextMenuItemContext()
|
const {disabled, destructive} = useContextMenuItemContext()
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
numberOfLines={2}
|
numberOfLines={2}
|
||||||
@@ -883,6 +884,7 @@ export function ItemText({children, style}: ItemTextProps) {
|
|||||||
a.font_semi_bold,
|
a.font_semi_bold,
|
||||||
t.atoms.text_contrast_high,
|
t.atoms.text_contrast_high,
|
||||||
style,
|
style,
|
||||||
|
destructive && {color: t.palette.negative_500},
|
||||||
disabled && t.atoms.text_contrast_low,
|
disabled && t.atoms.text_contrast_low,
|
||||||
]}>
|
]}>
|
||||||
{children}
|
{children}
|
||||||
@@ -892,14 +894,16 @@ export function ItemText({children, style}: ItemTextProps) {
|
|||||||
|
|
||||||
export function ItemIcon({icon: Comp}: ItemIconProps) {
|
export function ItemIcon({icon: Comp}: ItemIconProps) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {disabled} = useContextMenuItemContext()
|
const {disabled, destructive} = useContextMenuItemContext()
|
||||||
return (
|
return (
|
||||||
<Comp
|
<Comp
|
||||||
size="lg"
|
size="lg"
|
||||||
fill={
|
fill={
|
||||||
disabled
|
disabled
|
||||||
? t.atoms.text_contrast_low.color
|
? t.atoms.text_contrast_low.color
|
||||||
: t.atoms.text_contrast_medium.color
|
: destructive
|
||||||
|
? t.palette.negative_500
|
||||||
|
: t.atoms.text_contrast_medium.color
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export type MenuContextType = {
|
|||||||
|
|
||||||
export type ItemContextType = {
|
export type ItemContextType = {
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
|
destructive: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TriggerProps = {
|
export type TriggerProps = {
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ export let MessageContextMenu = ({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<ContextMenu.Item
|
<ContextMenu.Item
|
||||||
|
destructive
|
||||||
testID="messageDropdownDeleteBtn"
|
testID="messageDropdownDeleteBtn"
|
||||||
label={l`Delete message for me`}
|
label={l`Delete message for me`}
|
||||||
onPress={() => deleteControl.open()}>
|
onPress={() => deleteControl.open()}>
|
||||||
@@ -170,6 +171,7 @@ export let MessageContextMenu = ({
|
|||||||
</ContextMenu.Item>
|
</ContextMenu.Item>
|
||||||
{!isFromSelf && (
|
{!isFromSelf && (
|
||||||
<ContextMenu.Item
|
<ContextMenu.Item
|
||||||
|
destructive
|
||||||
testID="messageDropdownReportBtn"
|
testID="messageDropdownReportBtn"
|
||||||
label={l`Report message`}
|
label={l`Report message`}
|
||||||
onPress={() => reportControl.open()}>
|
onPress={() => reportControl.open()}>
|
||||||
|
|||||||
Reference in New Issue
Block a user