Skip to content

Commit 143bae3

Browse files
committed
feat(email encrypt): implement base64 encoding for contact email config
1 parent bdd1093 commit 143bae3

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

themes/commerce/components/Footer.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import CopyRightDate from '@/components/CopyRightDate'
44
import { siteConfig } from '@/lib/config'
55
import Link from 'next/link'
66
import CONFIG from '../config'
7+
import { decryptEmail, handleEmailClick } from '@/lib/plugins/mailEncrypt'
8+
import { useRef } from 'react'
79

810
/**
911
* 页脚
@@ -18,6 +20,10 @@ const Footer = props => {
1820
parseInt(since) < currentYear ? since + '-' + currentYear : currentYear
1921
const { categoryOptions, customMenu } = props
2022

23+
const CONTACT_EMAIL = siteConfig('CONTACT_EMAIL')
24+
25+
const emailIcon = useRef(null)
26+
2127
return (
2228
<footer
2329
id='footer-wrapper'
@@ -128,14 +134,16 @@ const Footer = props => {
128134
</div>
129135
<div className='text-lg'>
130136
{' '}
131-
{siteConfig('CONTACT_EMAIL') && (
137+
{CONTACT_EMAIL && (
132138
<a
133-
target='_blank'
134-
rel='noreferrer'
135-
title={'email'}
136-
href={`mailto:${siteConfig('CONTACT_EMAIL')}`}>
139+
onClick={e =>
140+
handleEmailClick(e, emailIcon, CONTACT_EMAIL)
141+
}
142+
title='email'
143+
className='cursor-pointer'
144+
ref={emailIcon}>
137145
<i className='transform hover:scale-125 duration-150 fas fa-envelope dark:hover:text-red-400 hover:text-red-600' />{' '}
138-
{siteConfig('CONTACT_EMAIL')}
146+
{decryptEmail(CONTACT_EMAIL)}
139147
</a>
140148
)}
141149
</div>

0 commit comments

Comments
 (0)