-
Notifications
You must be signed in to change notification settings - Fork 37
/
smsTo.js
31 lines (29 loc) · 950 Bytes
/
smsTo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React, { forwardRef } from 'react'
import CommentIcon from '../../Icons/Comment'
import withActionsLocales from './locales/withActionsLocales'
import ActionsMenuItem from '../ActionsMenuItem'
import ListItemIcon from '../../MuiCozyTheme/ListItemIcon'
import Icon from '../../Icon'
import ListItemText from '../../ListItemText'
export const smsTo = () => {
return {
name: 'smsTo',
action: doc => {
const phoneNumber = doc?.phone?.[0]?.number
!!phoneNumber && window.open(`sms:${phoneNumber}`, '_self')
},
Component: withActionsLocales(
// eslint-disable-next-line no-unused-vars
forwardRef(({ t, f, lang, ...props }, ref) => {
return (
<ActionsMenuItem {...props} ref={ref}>
<ListItemIcon>
<Icon icon={CommentIcon} />
</ListItemIcon>
<ListItemText primary={t('smsTo')} />
</ActionsMenuItem>
)
})
)
}
}